Skip to content

fix(cli): --version and --help display as errors #331

Description

@JamieMason

Syncpack version

14.3.1

Operating system(s)

Mac

Steps to reproduce

syncpack --version
syncpack --help

Expected behavior

Plain text output

syncpack --version
syncpack 14.3.1

syncpack --help
Consistent dependency versions in large JavaScript Monorepos

Usage: syncpack [COMMAND]

Commands:
  lint    Lint all versions and ranges and exit with 0 or 1 based on whether all files match your Syncpack configuration file
  fix     Ensure that multiple packages requiring the same dependency use the same version
  format  Sort package.json fields into a predictable order and nested fields alphabetically
  update  Update to the latest versions on the npm registry
  list    Query and inspect all dependencies in your project, both valid and invalid
  json    Output all dependencies as flattened JSON objects
  help    Print this message or the help of the given subcommand(s)

Options:
  -h, --help     Print help
  -V, --version  Print version

Actual behavior

Error icon and red text

syncpack --version
✗ syncpack 14.3.1

syncpack --help
✗ Consistent dependency versions in large JavaScript Monorepos

Usage: syncpack [COMMAND]

Commands:
  lint    Lint all versions and ranges and exit with 0 or 1 based on whether all files match your Syncpack configuration file
  fix     Ensure that multiple packages requiring the same dependency use the same version
  format  Sort package.json fields into a predictable order and nested fields alphabetically
  update  Update to the latest versions on the npm registry
  list    Query and inspect all dependencies in your project, both valid and invalid
  json    Output all dependencies as flattened JSON objects
  help    Print this message or the help of the given subcommand(s)

Options:
  -h, --help     Print help
  -V, --version  Print version

Optional comments

Introduced in 14.3.1, this is because --version and --help exit with 1:

syncpack/src/main.rs

Lines 50 to 56 in b78a24e

if let Err(e) = result {
let msg = e.to_string();
if !msg.is_empty() {
error!("{e}");
}
exit(1);
}

Check the CLI args to know whether this is a true error.

Also happens on commands such as syncpack list --help

Code of Conduct

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions