kasperpeulen / gist-generator

Create gists from the command line.
MIT License
3 stars 1 forks source link

Provide a -n (or other "don't really do it") option and/or confirm option #3

Open kwalrath opened 9 years ago

kwalrath commented 9 years ago

A -n or --preview option (I'm not sure of the best name) would be a nice way to make sure that you're creating/updating all the gists you want to, and nothing more. It looks like make uses the names "-n, --just-print, --dry-run, --recon". Of those, I prefer -n and --dry-run, but I'm not sure how well the latter would understood by non-native speakers of English; --recon is cute but seems too easy to misunderstand.

A confirm option such as -i (--interactive) is another possibility. I think -i is uncommon but used in mv and rm. Strangely, it has an almost opposite meaning in make (ignore errors!).

kwalrath commented 9 years ago

/cc @Sfshaza

kasperpeulen commented 9 years ago

So what kind of output would you want with this option ? Just a message which directories would be converted, if you would really run it ?

kwalrath commented 9 years ago

I think I'd want something like this (@Sfshaza, chime in if you have a better idea):

$ gist generate --dry-run
Would generate gists for the following apps:
* tutorial1/example1
  Existing gist: https://gist.git....
* tutorial1/example2
  Existing gist: https://...
* tutorial2
  No existing gist

And when you want more verbose output:

$ gist generate --dry-run --verbose
Would generate gists for the following apps:
* tutorial1/example1
  Existing gist: https://gist.git....
* tutorial1/example2
  Existing gist: https://...
* tutorial2
  No existing gist
Would not generate gists for the following directories:
* tutorial1: Directory contains no pubspec.yaml file.
* tutorial1/server_example: App contains no web/ directory
* tutorial1/client_example: Files under web/ can only be named index.html/main.dart/styles.css.
kasperpeulen commented 9 years ago

Okay, the output is not yet as nice, as you propose, would need to refactor a little bit more for that.

But it is kind of functional:

$ gist generate --dry-run
tutorial1/example1 is dartpadable
tutorial1/example2 is dartpadable
Skipping tutorial1/example3: Dartpads can't import dart:io.
tutorial2 is dartpadable

Btw, I have now done the --verbose flag to include all the skipping messages, many of them are I think not so useful. So I kind of do the useful skipping messages always, and the probably not useful skipping messages when running --verbose.

$ gist generate --dry-run --verbose
Skipping tutorial1: App contains no pubspec.yaml file.
tutorial1/example1 is dartpadable
Skipping tutorial1/example1/web: App contains no web directory.
tutorial1/example2 is dartpadable
Skipping tutorial1/example2/web: App contains no web directory.
Skipping tutorial1/example3: Dartpads can't import dart:io.
Skipping tutorial1/example3/web: App contains no web directory.
tutorial2 is dartpadable
Skipping tutorial2/web: App contains no web directory.
kwalrath commented 9 years ago

Nice! You're so quick!

kasperpeulen commented 9 years ago

Will leave this option, would be good to make the output a bit more readable