phodal / adr

Architecture Decision Records in Node.js with Reporter, supported Windows, GNU/Linux, macOS - 轻量级架构决策记录工具
https://phodal.github.io/adr/
MIT License
262 stars 52 forks source link

How to properly use command syntax #25

Closed MathieuLavigneCC closed 3 years ago

MathieuLavigneCC commented 4 years ago

I do not know how to use the command syntax from the CLI.

For instance, when I use this syntax :

adr -n "Title"

It works. But when I use that one :

adr new "Title"

I get no result at all, no error, no file created. I use Ubuntu 20.

It seems to me that the commander options, for instance this one :

.option('-n, new <title...>', 'create new ADR', create)

should be replaced with that :

.option('-n', 'create new ADR', create)
.command('new <title>')
  .description('create new ADR')
  .action(create)

I must be wrong because people may have already noticed it, but I don't know then, which is the good syntax.

phodal commented 4 years ago

Hi, @MathieuLavigneCC it's same, and it's also some in my macbook. I could be a bug. Have you try those from source code.

.option('-n', 'create new ADR', create)
.command('new <title>')
  .description('create new ADR')
  .action(create)

if it works, you can just make a PR. I don't have a Ubuntu machine

MathieuLavigneCC commented 4 years ago

Yes it works, I use it as a workaround. OK, let's go for a PR !

MathieuLavigneCC commented 4 years ago

I am working on the PR and here are some use cases I would like to share with you.

Using this syntax :

adr -n Title1 Title2

Creates only "Title1" adr file and not "Title2". How about you ?

It feels like this is not the proper way to use commander lib. You may not agree. I am wondering if this option syntax (a single "n" with a dash) is appropriate ? Maybe the command syntax is better suitable. For instance this syntax :

adr -n Title1 Title2

Should be deleted and replaced by :

adr new Title1 Title2

For all commands (new, list, update, etc...). May I delete every option syntax and replace them with command syntax ?

phodal commented 4 years ago

It's OK to only create Title1 for adr -n Title1 Title2

And then you can also delete option syntax.