blackbook icon indicating copy to clipboard operation
blackbook copied to clipboard

Make the command line tool better

Open drvinceknight opened this issue 6 years ago • 4 comments

Currently there are no options etc...

drvinceknight avatar Jan 25 '19 17:01 drvinceknight

One of the options available in black is --diff which will display the diff. We should be sure to implement that.

drvinceknight avatar Jan 30 '19 17:01 drvinceknight

Be sure to include --exclude and --include as options as well (see #26).

Here is the full output of black -h:

Usage: black [OPTIONS] [SRC]...

  The uncompromising code formatter.

Options:
  -l, --line-length INTEGER       How many characters per line to allow.
                                  [default: 88]
  --py36                          Allow using Python 3.6-only syntax on all
                                  input files.  This will put trailing commas
                                  in function signatures and calls also after
                                  *args and **kwargs.  [default: per-file
                                  auto-detection]
  --pyi                           Format all input files like typing stubs
                                  regardless of file extension (useful when
                                  piping source on standard input).
  -S, --skip-string-normalization
                                  Don't normalize string quotes or prefixes.
  -N, --skip-numeric-underscore-normalization
                                  Don't normalize underscores in numeric
                                  literals.
  --check                         Don't write the files back, just return the
                                  status.  Return code 0 means nothing would
                                  change.  Return code 1 means some files
                                  would be reformatted.  Return code 123 means
                                  there was an internal error.
  --diff                          Don't write the files back, just output a
                                  diff for each file on stdout.
  --fast / --safe                 If --fast given, skip temporary sanity
                                  checks. [default: --safe]
  --include TEXT                  A regular expression that matches files and
                                  directories that should be included on
                                  recursive searches.  An empty value means
                                  all files are included regardless of the
                                  name.  Use forward slashes for directories
                                  on all platforms (Windows, too).  Exclusions
                                  are calculated first, inclusions later.
                                  [default: \.pyi?$]
  --exclude TEXT                  A regular expression that matches files and
                                  directories that should be excluded on
                                  recursive searches.  An empty value means no
                                  paths are excluded. Use forward slashes for
                                  directories on all platforms (Windows, too).
                                  Exclusions are calculated first, inclusions
                                  later.  [default: /(\.git|\.hg|\.mypy_cache|
                                  \.nox|\.tox|\.venv|_build|buck-
                                  out|build|dist)/]
  -q, --quiet                     Don't emit non-error messages to stderr.
                                  Errors are still emitted, silence those with
                                  2>/dev/null.
  -v, --verbose                   Also emit messages to stderr about files
                                  that were not changed or were ignored due to
                                  --exclude=.
  --version                       Show the version and exit.
  --config PATH                   Read configuration from PATH.
  -h, --help                      Show this message and exit.

We don't necessarily HAVE to implement all of them.

drvinceknight avatar Jan 30 '19 18:01 drvinceknight

At the moment

$ blackbook --help
2019-11-29 14:00:36.931 | INFO     | blackbook.__main__:main:25 - All done! 📖
2019-11-29 14:00:36.931 | INFO     | blackbook.__main__:main:27 - 0 notebooks reformatted. 0 left unchanged.

It would be nice if --help gave some indication of how to use blackbook.

matthewfeickert avatar Nov 29 '19 20:11 matthewfeickert

Absolutely :+1:

drvinceknight avatar Nov 30 '19 10:11 drvinceknight