@@ -7,36 +7,12 @@ async fn main() -> miette::Result<()> {
77 dispatch_command ( cli) . await
88}
99
10- /// Prints abbreviated help showing only core commands.
11- ///
12- /// When the user runs `tern` without arguments, we show a shorter help
13- /// that highlights the most commonly used commands. The full command list
14- /// is available via `tern --help`.
15- fn print_short_help ( ) -> miette:: Result < ( ) > {
16- let cmd = Cli :: command ( ) ;
17- let version = cmd. get_version ( ) . unwrap_or ( "unknown" ) ;
18-
19- println ! ( "tern {version}" ) ;
20- println ! ( "A database migration tool written in Rust" ) ;
21- println ! ( ) ;
22- println ! ( "Usage: tern [OPTIONS] <COMMAND>" ) ;
23- println ! ( ) ;
24- println ! ( "Commands:" ) ;
25- println ! ( " version Print the CLI version and exit" ) ;
26- println ! ( " init Initialize a new Tern project with state backend" ) ;
27- println ! ( " status Show state backend status" ) ;
28- println ! ( " help Print this message or the help of the given subcommand(s)" ) ;
29- println ! ( ) ;
30- println ! ( "Options:" ) ;
31- println ! ( " -h, --help Print help (use 'tern --help' for all commands)" ) ;
32- println ! ( " -V, --version Print version" ) ;
33-
34- Ok ( ( ) )
35- }
36-
3710async fn dispatch_command ( cli : Cli ) -> miette:: Result < ( ) > {
38- match & cli. cmd {
39- None => print_short_help ( ) ,
40- Some ( cmd) => cmd. clone ( ) . dispatch ( ) . await ,
11+ match cli. cmd {
12+ None => {
13+ Cli :: command ( ) . print_help ( ) . ok ( ) ;
14+ Ok ( ( ) )
15+ }
16+ Some ( cmd) => cmd. dispatch ( ) . await ,
4117 }
4218}
0 commit comments