vilicvane / clime

⌨ The command-line interface framework for TypeScript.
252 stars 10 forks source link

Display a default value of an option, if specified #40

Closed dploeger closed 6 years ago

dploeger commented 6 years ago

This PR adds the default value of an option to its description, if one is specified.

However, I can not get the test suite to run.

I get the following errors when running npm run build:

(...)
$ tslint -c tslint.json -p tsconfig.json --type-check
--type-check is deprecated. You only need --project to enable rule which need type information.
Error at src/core/command/help.ts:188:21: Property 'bold' does not exist on type 'typeof "/Users/dennis.ploeger/Documents/prog/devops/forks/clime/node_modules/chalk/types/index"'.
Error at src/core/command/help.ts:189:42: Property 'dim' does not exist on type 'typeof "/Users/dennis.ploeger/Documents/prog/devops/forks/clime/node_modules/chalk/types/index"'.
Error at src/core/command/help.ts:194:21: Property 'bold' does not exist on type 'typeof "/Users/dennis.ploeger/Documents/prog/devops/forks/clime/node_modules/chalk/types/index"'.
Error at src/core/command/help.ts:204:11: Property 'green' does not exist on type 'typeof "/Users/dennis.ploeger/Documents/prog/devops/forks/clime/node_modules/chalk/types/index"'.
Error at src/core/command/help.ts:223:11: Property 'green' does not exist on type 'typeof "/Users/dennis.ploeger/Documents/prog/devops/forks/clime/node_modules/chalk/types/index"'.
Error at src/core/command/help.ts:224:13: Property 'bold' does not exist on type 'typeof "/Users/dennis.ploeger/Documents/prog/devops/forks/clime/node_modules/chalk/types/index"'.
Error at src/core/command/help.ts:246:19: Property 'bold' does not exist on type 'typeof "/Users/dennis.ploeger/Documents/prog/devops/forks/clime/node_modules/chalk/types/index"'.
Error at src/core/command/help.ts:268:17: Property 'bold' does not exist on type 'typeof "/Users/dennis.ploeger/Documents/prog/devops/forks/clime/node_modules/chalk/types/index"'.
Error at src/core/command/help.ts:286:13: Property 'bold' does not exist on type 'typeof "/Users/dennis.ploeger/Documents/prog/devops/forks/clime/node_modules/chalk/types/index"'.
Error at src/core/command/help.ts:296:11: Property 'green' does not exist on type 'typeof "/Users/dennis.ploeger/Documents/prog/devops/forks/clime/node_modules/chalk/types/index"'.
Error at src/core/command/help.ts:301:11: Property 'green' does not exist on type 'typeof "/Users/dennis.ploeger/Documents/prog/devops/forks/clime/node_modules/chalk/types/index"'.
Error at src/core/command/help.ts:331:19: Property 'bold' does not exist on type 'typeof "/Users/dennis.ploeger/Documents/prog/devops/forks/clime/node_modules/chalk/types/index"'.
Error at src/core/command/help.ts:337:11: Property 'green' does not exist on type 'typeof "/Users/dennis.ploeger/Documents/prog/devops/forks/clime/node_modules/chalk/types/index"'.
Error at src/core/error.ts:15:27: Property 'dim' does not exist on type 'typeof "/Users/dennis.ploeger/Documents/prog/devops/forks/clime/node_modules/chalk/types/index"'.
Error at src/shim/shim.ts:46:29: Property 'red' does not exist on type 'typeof "/Users/dennis.ploeger/Documents/prog/devops/forks/clime/node_modules/chalk/types/index"'.
Error at src/shim/shim.ts:48:29: Property 'red' does not exist on type 'typeof "/Users/dennis.ploeger/Documents/prog/devops/forks/clime/node_modules/chalk/types/index"'.
(...)
dploeger commented 6 years ago

Hm. Travis didn't have that issue seemingly...

dploeger commented 6 years ago

I'll try again to let it run locally, so I can add a test for the feature.

dploeger commented 6 years ago

Okay, done. I basically just accepted the baseman tests, because the default description was already displayed there of course.

coveralls commented 6 years ago

Coverage Status

Changes Unknown when pulling d2260962c2b74684b7d752511586786b0eca2abd on dodevops:master into on vilic:master.

vilicvane commented 6 years ago

Hi, thanks for this PR!

A small problem is that default could be falsy non-string value, we may need to update the condition.

And it would be nice if we add that case into tests.

dploeger commented 6 years ago

I added some tests and optimized the non-string outputs. I think, it's fine this way. Booleans are reported as "false" or "true" and null is reported as "null".

dploeger commented 6 years ago

Hm. Don't know, why travis fails. I don't think, it has to do with my modifications, though, because I didn't get the errors here.

vilicvane commented 6 years ago

@dploeger Hmm, it seems that some baseman reference files newly generated are added to this commit. Did you miss any?

dploeger commented 6 years ago

Argh. Damn. I forgot to add the reference files to git. 🤦‍♂️

coveralls commented 6 years ago

Coverage Status

Changes Unknown when pulling 64ba989fb5001ce602d0aa8699a2cd2176b5252c on dodevops:master into on vilic:master.

vilicvane commented 6 years ago

@dploeger Thanks! I may tweak the output format a little bit later, FYI.