Skip to content

cargo -C should have a long name #11696

@epage

Description

@epage

Problem

#10952 added -C to solve #10098 and reduce #2930's impact but we couldn't get buy-in on a name and shipped it as-is to not block the feature on the long name as -C by itself has enough use within the community

Proposed Solution

From ehuss:

I don't have a strong opinion about the long name. --cwd or --cd seems more explicit as to what it does, and would lean slightly towards that, but other options seem fine. -C seems to be the most common for a short flag.

A quick survey:

  • make: -C or --directory
  • git: -C
  • Meson: -C
  • ninja: -C
  • hg: --cwd
  • Gradle: -p, --project-dir?
  • Julia: --project?
  • Swift: -working-directory?
  • dub: --root
  • msbuild: passed as first argument
  • npm: n/a
  • Ivy: n/a?
  • Maven: n/a?
  • Bazel: n/a?
  • Buck: n/a?
  • go: -C
  • nuget: n/a?
  • sbt: n/a?
  • dart: -C or --directory

Other command line tools with similar flags:

  • tar: -C or --directory (BSD tar has --cd)
  • ls: -d or --directory to list directories
    • rm: -d or --dir to remove directories

Plus the stdlib calls this "current dir" (std::env::current_dir, std::process::Command::current_dir) so we could name it --current-dir

Notes

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-cliArea: Command-line interface, option parsing, etc.C-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`P-lowPriority: LowS-needs-team-inputStatus: Needs input from team on whether/how to proceed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions