mirror of
https://github.com/martinvonz/jj.git
synced 2024-12-24 12:48:55 +00:00
cli: rename jj support
to jj util
I wasn't quite happy with `jj support` but I couldn't think of
anything better when I moved the commands from `jj debug` in
e2b4d7058d
. Thanks to @ilyagr for suggesting `jj util`.
This commit is contained in:
parent
e492548772
commit
92a911b7a3
5 changed files with 30 additions and 30 deletions
|
@ -57,7 +57,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
instead.
|
instead.
|
||||||
|
|
||||||
* `jj debug completion`, `jj debug mangen` and `jj debug config-schema` have
|
* `jj debug completion`, `jj debug mangen` and `jj debug config-schema` have
|
||||||
been moved from `jj debug` to `jj support`.
|
been moved from `jj debug` to `jj util`.
|
||||||
|
|
||||||
* `jj describe` now supports `--reset-author` for resetting a commit's author
|
* `jj describe` now supports `--reset-author` for resetting a commit's author
|
||||||
to the configured user. `jj describe` also gained a `--no-edit` option to
|
to the configured user. `jj describe` also gained a `--no-edit` option to
|
||||||
|
|
12
README.md
12
README.md
|
@ -252,29 +252,29 @@ email = "martinvonz@google.com"
|
||||||
## Command-line completion
|
## Command-line completion
|
||||||
|
|
||||||
To set up command-line completion, source the output of
|
To set up command-line completion, source the output of
|
||||||
`jj support completion --bash/--zsh/--fish`. Exactly how to source it depends on
|
`jj util completion --bash/--zsh/--fish` (called `jj debug completion` in
|
||||||
your shell.
|
jj <= 0.7.0). Exactly how to source it depends on your shell.
|
||||||
|
|
||||||
### Bash
|
### Bash
|
||||||
```shell script
|
```shell script
|
||||||
source <(jj support completion) # --bash is the default
|
source <(jj util completion) # --bash is the default
|
||||||
```
|
```
|
||||||
|
|
||||||
### Zsh
|
### Zsh
|
||||||
```shell script
|
```shell script
|
||||||
autoload -U compinit
|
autoload -U compinit
|
||||||
compinit
|
compinit
|
||||||
source <(jj support completion --zsh)
|
source <(jj util completion --zsh)
|
||||||
```
|
```
|
||||||
|
|
||||||
### Fish
|
### Fish
|
||||||
```shell script
|
```shell script
|
||||||
jj support completion --fish | source
|
jj util completion --fish | source
|
||||||
```
|
```
|
||||||
|
|
||||||
### Xonsh
|
### Xonsh
|
||||||
```shell script
|
```shell script
|
||||||
source-bash $(jj support completion)
|
source-bash $(jj util completion)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -63,13 +63,13 @@
|
||||||
libiconv
|
libiconv
|
||||||
];
|
];
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
$out/bin/jj support mangen > ./jj.1
|
$out/bin/jj util mangen > ./jj.1
|
||||||
installManPage ./jj.1
|
installManPage ./jj.1
|
||||||
|
|
||||||
installShellCompletion --cmd jj \
|
installShellCompletion --cmd jj \
|
||||||
--bash <($out/bin/jj support completion --bash) \
|
--bash <($out/bin/jj util completion --bash) \
|
||||||
--fish <($out/bin/jj support completion --fish) \
|
--fish <($out/bin/jj util completion --fish) \
|
||||||
--zsh <($out/bin/jj support completion --zsh)
|
--zsh <($out/bin/jj util completion --zsh)
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
default = self.packages.${system}.jujutsu;
|
default = self.packages.${system}.jujutsu;
|
||||||
|
|
|
@ -115,7 +115,7 @@ enum Commands {
|
||||||
Squash(SquashArgs),
|
Squash(SquashArgs),
|
||||||
Status(StatusArgs),
|
Status(StatusArgs),
|
||||||
#[command(subcommand)]
|
#[command(subcommand)]
|
||||||
Support(SupportCommands),
|
Util(UtilCommands),
|
||||||
/// Undo an operation (shortcut for `jj op undo`)
|
/// Undo an operation (shortcut for `jj op undo`)
|
||||||
Undo(operation::OperationUndoArgs),
|
Undo(operation::OperationUndoArgs),
|
||||||
Unsquash(UnsquashArgs),
|
Unsquash(UnsquashArgs),
|
||||||
|
@ -888,27 +888,27 @@ struct SparseArgs {
|
||||||
|
|
||||||
/// Infrequently used commands such as for generating shell completions
|
/// Infrequently used commands such as for generating shell completions
|
||||||
#[derive(Subcommand, Clone, Debug)]
|
#[derive(Subcommand, Clone, Debug)]
|
||||||
enum SupportCommands {
|
enum UtilCommands {
|
||||||
Completion(SupportCompletionArgs),
|
Completion(UtilCompletionArgs),
|
||||||
Mangen(SupportMangenArgs),
|
Mangen(UtilMangenArgs),
|
||||||
ConfigSchema(SupportConfigSchemaArgs),
|
ConfigSchema(UtilConfigSchemaArgs),
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Print a command-line-completion script
|
/// Print a command-line-completion script
|
||||||
#[derive(clap::Args, Clone, Debug)]
|
#[derive(clap::Args, Clone, Debug)]
|
||||||
struct SupportCompletionArgs {
|
struct UtilCompletionArgs {
|
||||||
/// Print a completion script for Bash
|
/// Print a completion script for Bash
|
||||||
///
|
///
|
||||||
/// Apply it by running this:
|
/// Apply it by running this:
|
||||||
///
|
///
|
||||||
/// source <(jj support completion)
|
/// source <(jj util completion)
|
||||||
#[arg(long, verbatim_doc_comment)]
|
#[arg(long, verbatim_doc_comment)]
|
||||||
bash: bool,
|
bash: bool,
|
||||||
/// Print a completion script for Fish
|
/// Print a completion script for Fish
|
||||||
///
|
///
|
||||||
/// Apply it by running this:
|
/// Apply it by running this:
|
||||||
///
|
///
|
||||||
/// jj support completion --fish | source
|
/// jj util completion --fish | source
|
||||||
#[arg(long, verbatim_doc_comment)]
|
#[arg(long, verbatim_doc_comment)]
|
||||||
fish: bool,
|
fish: bool,
|
||||||
/// Print a completion script for Zsh
|
/// Print a completion script for Zsh
|
||||||
|
@ -917,7 +917,7 @@ struct SupportCompletionArgs {
|
||||||
///
|
///
|
||||||
/// autoload -U compinit
|
/// autoload -U compinit
|
||||||
/// compinit
|
/// compinit
|
||||||
/// source <(jj support completion --zsh | sed '$d') # remove the last line
|
/// source <(jj util completion --zsh | sed '$d') # remove the last line
|
||||||
/// compdef _jj jj
|
/// compdef _jj jj
|
||||||
#[arg(long, verbatim_doc_comment)]
|
#[arg(long, verbatim_doc_comment)]
|
||||||
zsh: bool,
|
zsh: bool,
|
||||||
|
@ -925,11 +925,11 @@ struct SupportCompletionArgs {
|
||||||
|
|
||||||
/// Print a ROFF (manpage)
|
/// Print a ROFF (manpage)
|
||||||
#[derive(clap::Args, Clone, Debug)]
|
#[derive(clap::Args, Clone, Debug)]
|
||||||
struct SupportMangenArgs {}
|
struct UtilMangenArgs {}
|
||||||
|
|
||||||
/// Print the JSON schema for the jj TOML config format.
|
/// Print the JSON schema for the jj TOML config format.
|
||||||
#[derive(clap::Args, Clone, Debug)]
|
#[derive(clap::Args, Clone, Debug)]
|
||||||
struct SupportConfigSchemaArgs {}
|
struct UtilConfigSchemaArgs {}
|
||||||
|
|
||||||
/// Low-level commands not intended for users
|
/// Low-level commands not intended for users
|
||||||
#[derive(Subcommand, Clone, Debug)]
|
#[derive(Subcommand, Clone, Debug)]
|
||||||
|
@ -3067,13 +3067,13 @@ fn make_branch_term(branch_names: &[impl AsRef<str>]) -> String {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn cmd_support(
|
fn cmd_util(
|
||||||
ui: &mut Ui,
|
ui: &mut Ui,
|
||||||
command: &CommandHelper,
|
command: &CommandHelper,
|
||||||
subcommand: &SupportCommands,
|
subcommand: &UtilCommands,
|
||||||
) -> Result<(), CommandError> {
|
) -> Result<(), CommandError> {
|
||||||
match subcommand {
|
match subcommand {
|
||||||
SupportCommands::Completion(completion_matches) => {
|
UtilCommands::Completion(completion_matches) => {
|
||||||
let mut app = command.app().clone();
|
let mut app = command.app().clone();
|
||||||
let mut buf = vec![];
|
let mut buf = vec![];
|
||||||
let shell = if completion_matches.zsh {
|
let shell = if completion_matches.zsh {
|
||||||
|
@ -3086,13 +3086,13 @@ fn cmd_support(
|
||||||
clap_complete::generate(shell, &mut app, "jj", &mut buf);
|
clap_complete::generate(shell, &mut app, "jj", &mut buf);
|
||||||
ui.stdout_formatter().write_all(&buf)?;
|
ui.stdout_formatter().write_all(&buf)?;
|
||||||
}
|
}
|
||||||
SupportCommands::Mangen(_mangen_matches) => {
|
UtilCommands::Mangen(_mangen_matches) => {
|
||||||
let mut buf = vec![];
|
let mut buf = vec![];
|
||||||
let man = clap_mangen::Man::new(command.app().clone());
|
let man = clap_mangen::Man::new(command.app().clone());
|
||||||
man.render(&mut buf)?;
|
man.render(&mut buf)?;
|
||||||
ui.stdout_formatter().write_all(&buf)?;
|
ui.stdout_formatter().write_all(&buf)?;
|
||||||
}
|
}
|
||||||
SupportCommands::ConfigSchema(_config_schema_matches) => {
|
UtilCommands::ConfigSchema(_config_schema_matches) => {
|
||||||
// TODO(#879): Consider generating entire schema dynamically vs. static file.
|
// TODO(#879): Consider generating entire schema dynamically vs. static file.
|
||||||
let buf = include_bytes!("../config-schema.json");
|
let buf = include_bytes!("../config-schema.json");
|
||||||
ui.stdout_formatter().write_all(buf)?;
|
ui.stdout_formatter().write_all(buf)?;
|
||||||
|
@ -3521,7 +3521,7 @@ pub fn run_command(
|
||||||
Commands::Workspace(sub_args) => cmd_workspace(ui, command_helper, sub_args),
|
Commands::Workspace(sub_args) => cmd_workspace(ui, command_helper, sub_args),
|
||||||
Commands::Sparse(sub_args) => cmd_sparse(ui, command_helper, sub_args),
|
Commands::Sparse(sub_args) => cmd_sparse(ui, command_helper, sub_args),
|
||||||
Commands::Git(sub_args) => git::cmd_git(ui, command_helper, sub_args),
|
Commands::Git(sub_args) => git::cmd_git(ui, command_helper, sub_args),
|
||||||
Commands::Support(sub_args) => cmd_support(ui, command_helper, sub_args),
|
Commands::Util(sub_args) => cmd_util(ui, command_helper, sub_args),
|
||||||
#[cfg(feature = "bench")]
|
#[cfg(feature = "bench")]
|
||||||
Commands::Bench(sub_args) => bench::cmd_bench(ui, command_helper, sub_args),
|
Commands::Bench(sub_args) => bench::cmd_bench(ui, command_helper, sub_args),
|
||||||
Commands::Debug(sub_args) => cmd_debug(ui, command_helper, sub_args),
|
Commands::Debug(sub_args) => cmd_debug(ui, command_helper, sub_args),
|
||||||
|
|
|
@ -19,9 +19,9 @@ use crate::common::TestEnvironment;
|
||||||
pub mod common;
|
pub mod common;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_support_config_schema() {
|
fn test_util_config_schema() {
|
||||||
let test_env = TestEnvironment::default();
|
let test_env = TestEnvironment::default();
|
||||||
let stdout = test_env.jj_cmd_success(test_env.env_root(), &["support", "config-schema"]);
|
let stdout = test_env.jj_cmd_success(test_env.env_root(), &["util", "config-schema"]);
|
||||||
// Validate partial snapshot, redacting any lines nested 2+ indent levels.
|
// Validate partial snapshot, redacting any lines nested 2+ indent levels.
|
||||||
insta::with_settings!({filters => vec![(r"(?m)(^ .*$\r?\n)+", " [...]\n")]}, {
|
insta::with_settings!({filters => vec![(r"(?m)(^ .*$\r?\n)+", " [...]\n")]}, {
|
||||||
assert_snapshot!(stdout, @r###"
|
assert_snapshot!(stdout, @r###"
|
Loading…
Reference in a new issue