Skip to content
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

Syntax: "denox start" as option to "denox run start" #7

Open
1 of 3 tasks
dllmkdir opened this issue May 16, 2020 · 4 comments
Open
1 of 3 tasks

Syntax: "denox start" as option to "denox run start" #7

dllmkdir opened this issue May 16, 2020 · 4 comments

Comments

@dllmkdir
Copy link

Issue Type

  • Bug Report
  • Feature Request
  • Other

Expected

Denox could run a denox option to create a better shorthand command.
The "run" word could be preserved. as optional

denox start
denox run start

Actual

denox run start

Possible Solutions

Could fork the project to start this feature.
BTW, Awesome Library! I was searching for something like this

Info

  • DenoX version:
    denox/0.3.0 darwin-x86_64 deno-1.0.0
@BentoumiTech
Copy link
Owner

Thank you @dllmkdir it would be a good addition.

As I am currently adding a couple of commands eg: denox init it would be nice to have a set of reserved script names with an explanatory error message.

For example if a user adds a script named init:

scripts:
  init:
    file: main.ts

We could display a warning saying that init is a reserved keyword and the script cannot be run with the shorthand command.

Feel free to make a PR, if you need any help let me know

@BentoumiTech BentoumiTech added the good first issue Good for newcomers label May 17, 2020
@jsejcksn
Copy link

I love less typing, too! I have proposed an alternate solution to this in #16

@jsejcksn
Copy link

I want to echo what @BentoumiTech said about reserved words, and also add another note:

It is more robust CLI design to reserve argument positions for the types they represent.

Currently, the first argument to denox is a command keyword, and by introducing this change, there will be two kinds of consequences:

  1. Enumerating which commands can/will exist and need to be reserved now
  2. Causing a breaking change in the future if a new command ever needs to be added that was not considered now

@ghost
Copy link

ghost commented Oct 23, 2021

Very interesting proposal. Just wanna drop another use case to consider.

I would love to do denox unit to start a deno test --watch --import-map=index.unit.importmap.json index.test.ts (thx @jsejcksn for this suggestion).

Imagine the workspace file would look some like:

scripts:
  unit:
    command: test
    # 👆  command be of type "run" | "test" with "run" as default
    deno_options:
      watch: true
      import-map: index.unit.importmap.json index.test.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants