cli: move $JJ_VERSION out of CLI library

It should be up to the binary to decide which version it is. One
should be able to build the library without specifying a version.
This commit is contained in:
Martin von Zweigbergk 2023-04-20 15:17:08 -07:00 committed by Martin von Zweigbergk
parent 6cb64bd255
commit 39e83b9f4a
3 changed files with 8 additions and 3 deletions

View file

@ -2294,6 +2294,12 @@ impl CliRunner {
}
}
/// Set the version to be displayed by `jj version`.
pub fn version(mut self, version: &'static str) -> Self {
self.app = self.app.version(version);
self
}
/// Replaces `StoreFactories` to be used.
pub fn set_store_factories(mut self, store_factories: StoreFactories) -> Self {
self.store_factories = Some(store_factories);

View file

@ -3473,8 +3473,7 @@ fn cmd_sparse(ui: &mut Ui, command: &CommandHelper, args: &SparseArgs) -> Result
}
pub fn default_app() -> Command {
let app: Command = Commands::augment_subcommands(Args::command());
app.version(env!("JJ_VERSION"))
Commands::augment_subcommands(Args::command())
}
pub fn run_command(

View file

@ -15,5 +15,5 @@
use jujutsu::cli_util::CliRunner;
fn main() -> std::process::ExitCode {
CliRunner::init().run()
CliRunner::init().version(env!("JJ_VERSION")).run()
}