Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to clap v3 with new help messages #409

Merged
merged 5 commits into from Mar 17, 2022
Merged

Conversation

JohnnyMorganz
Copy link
Owner

Structopt has been deprecated, migrating to clap v3.
Main features:

  • help output now has colours
  • help output is better spaced to be easier to read
  • formatting options are now in a separate subheading in the help output
Old help message
stylua 0.12.5
A utility to format Lua code

USAGE:
    stylua.exe [FLAGS] [OPTIONS] [--] [files]...

FLAGS:
    -c, --check                        Runs in 'check' mode. Exits with 0 if all formatting is OK, Exits with 1 if the
                                       formatting is incorrect. Any files input will not be overwritten
    -h, --help                         Prints help information
    -s, --search-parent-directories    Search parent directories for stylua.toml, if not found in current directory.
                                       Ignored if config_path is provided. Keeps searching recursively up the parent
                                       directory tree, until the root directory is reached. If not found, looks in
                                       $XDG_CONFIG_HOME or $XDG_CONFIG_HOME/stylua
    -V, --version                      Prints version information
    -v, --verbose                      Whether to print out verbose output
        --verify                       Verify the output after formatting. Checks the generated AST with the original
                                       AST to detect if code correctness has changed

OPTIONS:
        --call-parentheses <call-parentheses>
            Specify whether to apply parentheses on function calls with signle string or table arg [possible values:
            Always, NoSingleString, NoSingleTable, None]
        --color <color>                           [default: auto]  [possible values: Always, Auto, Never]
        --column-width <column-width>            The column width to use to attempt to wrap lines
    -f, --config-path <config-path>              Specify path to stylua.toml configuration file
    -g, --glob <glob>...
            Any glob patterns to test against which files to check. To ignore a specific glob pattern, begin the glob
            pattern with `!`
        --indent-type <indent-type>              The type of indents to use [possible values: Tabs, Spaces]
        --indent-width <indent-width>            The width of a single indentation level
        --line-endings <line-endings>            The type of line endings to use [possible values: Unix, Windows]
        --num-threads <num-threads>
            The number of threads to use to format files in parallel. Defaults to the number of logical cores on your
            system [default: 12]
        --quote-style <quote-style>
            The style of quotes to use in string literals [possible values: AutoPreferDouble, AutoPreferSingle,
            ForceDouble, ForceSingle]
        --range-end <range-end>
            An ending range to format files, given as a byte offset from the beginning of the file. Any content after
            this value will be ignored
        --range-start <range-start>
            A starting range to format files, given as a byte offset from the beginning of the file. Any content before
            this value will be ignored
        --stdin-filepath <stdin-filepath>
            Specify the location of the file that is being passed into stdin. Ignored if not taking in input from stdin.
            This option is only used to help determine where to find the configuration file

ARGS:
    <files>...    A list of files to format

New help message
stylua 0.12.5
A utility to format Lua code

USAGE:
    stylua.exe [OPTIONS] [FILES]...

ARGS:
    <FILES>...
            A list of files to format

OPTIONS:
    -c, --check
            Runs in 'check' mode.
            
            Compares a diff between all input files to determine if they are formatted. Exits with 0
            if all formatting is OK, Exits with 1 if any formatting is incorrect, outputting file
            diffs. Any files input will not be overwritten.

        --color <COLOR>
            Use colored output
            
            [default: Auto]
            [possible values: Always, Auto, Never]

    -f, --config-path <CONFIG_PATH>
            Specify path to stylua.toml configuration file.
            
            If not provided, defaults to looking in the current directory for a configuration file.

    -g, --glob <GLOB>
            Glob patterns to test against which files to check.
            
            To ignore a specific glob pattern, begin the glob pattern with `!`

    -h, --help
            Print help information

        --num-threads <NUM_THREADS>
            The number of threads to use to format files in parallel.
            
            Defaults to the number of logical cores on your system.
            
            [default: 12]

        --range-end <RANGE_END>
            An ending range to format files, given as a byte offset from the beginning of the file.
            
            Any content after this value will be ignored.

        --range-start <RANGE_START>
            A starting range to format files, given as a byte offset from the beginning of the file.
            
            Any content before this value will be ignored.

    -s, --search-parent-directories
            Search parent directories for stylua.toml, if not found in current directory. Ignored if
            config_path is provided.
            
            Keeps searching recursively up the parent directory tree, until the root directory is
            reached. If not found, looks in $XDG_CONFIG_HOME or $XDG_CONFIG_HOME/stylua.

        --stdin-filepath <STDIN_FILEPATH>
            Specify the location of the file that is being passed into stdin. Ignored if not taking
            in input from stdin.
            
            This option is only used to help determine where to find the configuration file.

    -v, --verbose
            Enables verbose output

    -V, --version
            Print version information

        --verify
            Verifies the output correctness after formatting.
            
            Checks the generated AST with the original AST to detect if code correctness has
            changed.

FORMATTING OPTIONS:
        --call-parentheses <CALL_PARENTHESES>
            Specify whether to apply parentheses on function calls with signle string or table arg
            
            [possible values: Always, NoSingleString, NoSingleTable, None]

        --column-width <COLUMN_WIDTH>
            The column width to use to attempt to wrap lines

        --indent-type <INDENT_TYPE>
            The type of indents to use
            
            [possible values: Tabs, Spaces]

        --indent-width <INDENT_WIDTH>
            The width of a single indentation level

        --line-endings <LINE_ENDINGS>
            The type of line endings to use
            
            [possible values: Unix, Windows]

        --quote-style <QUOTE_STYLE>
            The style of quotes to use in string literals
            
            [possible values: AutoPreferDouble, AutoPreferSingle, ForceDouble, ForceSingle]

@codecov
Copy link

codecov bot commented Mar 17, 2022

Codecov Report

Merging #409 (ce1ab54) into master (32208aa) will increase coverage by 0.14%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master     #409      +/-   ##
==========================================
+ Coverage   96.25%   96.40%   +0.14%     
==========================================
  Files          14       14              
  Lines        5047     5057      +10     
==========================================
+ Hits         4858     4875      +17     
+ Misses        189      182       -7     
Impacted Files Coverage Δ
src/formatters/functions.rs 98.60% <0.00%> (+1.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 32208aa...ce1ab54. Read the comment docs.

@JohnnyMorganz JohnnyMorganz merged commit beec674 into master Mar 17, 2022
@JohnnyMorganz JohnnyMorganz deleted the upgrade-clap branch March 17, 2022 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants