Crate workspacer_cli Copy item path Source AddCrateCommand AddInternalDepCommand Define a new struct for the “internal-dep” subcommand arguments.
It needs target_crate, dep_crate, an optional workspace_path
and a skip_git_check flag, just like the other subcommands. AnalyzeCrateCommand For analyzing a single crate, we’ll require: AnalyzeWorkspaceCommand For analyzing an entire workspace, we define a similar struct but without a crate name.
We just need to know (optionally) the workspace path and skip-git-check. BumpCrateDownstreamsCommand Bump a single crate and all crates that depend on it (recursively),
using BumpCrateAndDownstreams::bump_crate_and_downstreams. BumpSingleCrateCommand Bump just a single crate (no downstream references updated).
We use the Bump trait on the crate handle itself. BumpWorkspaceCommand Bump all crates in the workspace at once. We use BumpAll::bump_all. CheckPublishReadyCrateCommand For checking a single crate, we use the typical pattern of: CheckPublishReadyWorkspaceCommand For checking the entire workspace, we do a simpler approach: CleanupCrateCommand For Crate subcommand usage: ws cleanup crate --crate MY_CRATE [--workspace ...] [--skip-git-check] CleanupWorkspaceCommand For Workspace subcommand usage: ws cleanup workspace [--path ...] [--skip-git-check] CoverageCrateCommand Subcommand for ws coverage crate --crate <NAME> [--workspace ...] [--skip-git-check] CoverageWorkspaceCommand Subcommand for ws coverage workspace [--path ...] [--skip-git-check] DetectCyclesCrateCommand DetectCyclesWorkspaceCommand FormatAllImportsCommand Subcommand data for ws format all-imports --path <dir> [--skip-git-check] FormatImportsCommand Subcommand data for ws format imports --crate <crate_name> [--workspace <dir>] [--skip-git-check] PruneCrateCommand Subcommand data for ws prune crate --crate <NAME> [--workspace <dir>] [--skip-git-check] PruneWorkspaceCommand Subcommand data for ws prune workspace [--path <DIR>] [--skip-git-check] ReleaseArg A helper struct for specifying how to bump version (major, minor, patch, alphaN).
Example CLI usage: --release patch or --release alpha=3 TopoSubcommand TreeSubcommand TreeSubcommandBuilder Builder for TreeSubcommand . AddSubcommand AnalyzeSubcommand First, let’s extend our AnalyzeSubcommand to handle two variants: BumpSubcommand Our top-level subcommand for ws bump.
We have three variants: CheckPublishReadySubcommand We’ll extend CheckPublishReadySubcommand to have two variants: CleanupSubcommand The top-level CleanupSubcommand has two variants: CoverageSubcommand DetectCyclesSubcommand DocumentSubcommand Document the workspace or crate (like cargo doc) FileFilterCli FormatSubcommand Format imports in all crates or a single crate GetSubcommand GitSubcommand Subcommands for ws git InfoSubcommand Print general info about the workspace or crate LintSubcommand Now we can refactor our LintSubcommand to use run_with_crate for the Crate variant: MetaSubcommand In your CLI code, define the MetaSubcommand with two variants: NameSubcommand OrganizeSubcommand Organize the workspace or a single crate PinSubcommand PruneSubcommand The top-level prune subcommand has two variants: PublishSubcommand ReadmeWriterCli A single fused enum with subcommands, each having all the config flags duplicated. RegisterSubcommand Register subcommand for naming files, adding crate references, etc. ShowSubcommand TreeSubcommandBuilderError Error type for TreeSubcommandBuilder UpgradeSubcommand ValidateSubcommand Validate everything (or just one crate) WatchSubcommand Watch for changes in a single crate or the entire workspace,
rebuilding/testing on file changes until canceled. get_lock_versions_flow This function handles the lock-versions logic: get_toml_section_flow This function handles the ws get toml --section <SECTION> [--crate <NAME>] logic: