-
Notifications
You must be signed in to change notification settings - Fork 637
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
proposal: Move std/flags
to std/cli
#3526
Comments
This would also provide a nice space for other CLI tools such as helpers for consuming stdin, common prompts such as "askForInt", a standard way of detecting terminal color support, etc. |
I'm a little against this direction because such kind of features tend to belong to 'CLI framework' categories (They tend to need to be opinionated in some way). Also there are at least 2 major frameworks (yargs, cliffy) existing which officially support Deno. I'm not sure it's good idea to start competing with them at this point.
FYI better color support is being done in denoland/deno#18549 |
Cool! I do question it being in core though as
I totally agree the std should be unopinionated, and that's exactly what is different about these CLI tools. Because of that I don't think they will compete with cliffy and the like. For example the askFor.int is going to be very close to the builtin But for most of my cli's I prefer Deno flags because it's a tool not a framework, it's mostly unoptinonated, and it's a minimal + flat dependency that's vetted and stable instead of a giant chain of deps crammed with features. If anything I would actually like to flags to be more unopionated (e.g. make it so that Unlike cliffy or args, every tool under cli/ should work independently, and I think didYouMean and flags are a good examples. |
I support a change that renames |
I literally have a vs code snipped called |
I'm weakly against this but need a clearer image. What do we think the list of symbols would be for an
|
Before I list some things, I want to mention I make bootstrapping scripts where audit-ability, correctness and simplicity are key. Think of these tools as things that could go in the deno bootstrapping script
|
I'll preface the following replies by saying there's no need to fixate on these technicalities. These are just initial thoughts on ideas. Again, the aim is to picture what a
+1 for something like this. My idea was
Sorry, what would it do?
What would be a use case?
Thing is, some of these are so trivial to do by yourself that I wonder whether it'd make sense to have them in the Standard Library. Also, IIUC
Yep, that's #3752. |
I probably shouldve mentioned this first; even if parseFlags is the ONLY tool, I still think it would still be good to have it under std/cli.
Sorry, you can ignore that comment. Back in older versions like Deno 1.25 I would've said "Deno std needs a helper for getting the width and height of the user's terminal" but recent versions of Deno actually just have it as a built-in feature.
Oh! I didn't realize Deno made use of that API. I definitely agree that would be redundant.
Knowing if color would be rendered correctly? Even if Deno.noColor is false, it doesn't mean the users terminal actually supports color output.
I apologize if this comes off as harsh, don't mean it personally, it's just this^ argument really grinds my gears: You could say that about half the stuff in std. Look at deferedPromise, weekOfYear, or stuff like More importantly, look at confirm() itself
Triviality has nothing to do with whether or not people would find a function useful. If std is not designed to reduce code duplication, then what is its purpose? |
Fair points, @jeff-hykin. I now agree that we should have an However, I think the sub-module must remain plain and unopinionated and doesn't do more than it needs to. WDYT, @kt3k? |
Alrighty, let's go ahead with this move. @lino-levan, I've done an initial review of your PR. |
Currently, we have this top level module which is both confusingly named (what is flags referring to? -- not immediately clear imo) and incredibly limiting in scope. I think this would be a lot better if the TLM was named
std/cli
. This would also open a lot of opportunities for new utilities that I would find quite useful imo.See #3488 for context on initial discussion.
cc @jeff-hykin @kt3k @iuioiua
The text was updated successfully, but these errors were encountered: