Skip to content

Commit a2ad5e7

Browse files
committed
fix: run hj should fallback to jj instead of showing help prompt
1 parent d0f4e60 commit a2ad5e7

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/commit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ pub(crate) fn command_reset(
102102
force: bool,
103103
) -> anyhow::Result<()> {
104104
let args: Vec<&str> = vec![
105-
"squashaaaaa",
105+
"squash",
106106
"--interactive",
107107
"--from",
108108
from.as_deref().unwrap_or("@-"),

src/main.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ use crate::{
4444
#[command(about = "Fast, opinionated version control experience.", long_about = None)]
4545
struct Cli {
4646
#[command(subcommand)]
47-
command: Commands,
47+
command: Option<Commands>,
4848
}
4949

5050
#[derive(Subcommand)]
@@ -295,7 +295,16 @@ fn main() {
295295
}
296296

297297
let cli = Cli::parse();
298-
match &cli.command {
298+
299+
// If no subcommand is provided, fallback to jj
300+
let Some(command) = &cli.command else {
301+
if let Err(e) = handle_fallback_command(&[]) {
302+
error(&e.to_string());
303+
}
304+
return;
305+
};
306+
307+
match command {
299308
Commands::Init {
300309
github,
301310
private,

0 commit comments

Comments
 (0)