denox icon indicating copy to clipboard operation
denox copied to clipboard

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

Open dllmkdir opened this issue 5 years ago • 4 comments

Issue Type

  • [ ] Bug Report
  • [x] 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

dllmkdir avatar May 16 '20 01:05 dllmkdir

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 avatar May 16 '20 06:05 BentoumiTech

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

jsejcksn avatar Jun 29 '20 00:06 jsejcksn

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

jsejcksn avatar Aug 13 '20 18:08 jsejcksn

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

ghost avatar Oct 23 '21 20:10 ghost