Nexmo / nexmo-cli

Nexmo CLI (Command Line Interface)
https://nexmo.com
MIT License
78 stars 52 forks source link

[WIP] split aliases into duplicate commands #174

Closed Chovin closed 5 years ago

Chovin commented 5 years ago

Summary

moved numbers:buy into a separate command so the alias is not overwritten by nb. This doesn't seem very DRY though and I'm not quite sure how to make sure this doesn't happen since commander silently overwrites the alias. Subclass it?

What would be the preferred way to handle this?

Other Information

partially handles #141

Thanks for contributing to the Nexmo CLI!

AlexLakatos commented 5 years ago

I think that's fine.

AlexLakatos commented 5 years ago

Thanks for making the changes. Are there any other commands with more than one alias left in the bin file?

Chovin commented 5 years ago

no more. all clean! 😄

[09:31:06] (master) src
// ♥pcregrep -M "^commander((.|\n  )*?alias){2}" bin.js
commander
  .command('number:buy [number_pattern]')
  .description('Buy a number to use for voice or SMS. If a --country_code is provided then the number_pattern is used to sea
rch for a number in the given country.')

  .alias('numbers:buy')
  .alias('nb')

[09:31:11] (master) src
// ♥git checkout patch-1
Switched to branch 'patch-1'
Your branch is up to date with 'origin/patch-1'.

[09:31:19] (patch-1) src
// ♥pcregrep -M "^commander((.|\n  )*?alias){2}" bin.js
[09:31:21] (patch-1) src
// ♥
AlexLakatos commented 5 years ago

Thanks for checking. And thanks for the PR!