mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-10-21 04:32:05 +00:00
Use a pager for the help interactive command as well
This commit is contained in:
parent
5e880b92f5
commit
a4e43b3925
2 changed files with 21 additions and 15 deletions
|
|
@ -96,19 +96,21 @@ func shell_loop(rl *readline.Readline, kill_if_signaled bool) (int, error) {
|
|||
return 0, nil
|
||||
}
|
||||
|
||||
func print_basic_help() {
|
||||
fmt.Println("Control kitty by sending it commands.")
|
||||
fmt.Println()
|
||||
fmt.Println(formatter.Title("Commands") + ":")
|
||||
func show_basic_help() {
|
||||
output := strings.Builder{}
|
||||
fmt.Fprintln(&output, "Control kitty by sending it commands.")
|
||||
fmt.Fprintln(&output)
|
||||
fmt.Fprintln(&output, formatter.Title("Commands")+":")
|
||||
r := EntryPoint(cli.NewRootCommand())
|
||||
for _, g := range r.SubCommandGroups {
|
||||
for _, sc := range g.SubCommands {
|
||||
fmt.Println(" ", formatter.Green(sc.Name))
|
||||
fmt.Println(" ", sc.ShortDescription)
|
||||
fmt.Fprintln(&output, " ", formatter.Green(sc.Name))
|
||||
fmt.Fprintln(&output, " ", sc.ShortDescription)
|
||||
}
|
||||
}
|
||||
fmt.Println(" ", formatter.Green("exit"))
|
||||
fmt.Println(" ", "Exit this shell")
|
||||
fmt.Fprintln(&output, " ", formatter.Green("exit"))
|
||||
fmt.Fprintln(&output, " ", "Exit this shell")
|
||||
cli.ShowHelpInPager(output.String())
|
||||
}
|
||||
|
||||
func exec_command(rl *readline.Readline, cmdline string) bool {
|
||||
|
|
@ -131,7 +133,7 @@ func exec_command(rl *readline.Readline, cmdline string) bool {
|
|||
hi.ExitCode = 0
|
||||
defer rl.AddHistoryItem(hi)
|
||||
if len(parsed_cmdline) == 1 {
|
||||
print_basic_help()
|
||||
show_basic_help()
|
||||
return true
|
||||
}
|
||||
switch parsed_cmdline[1] {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue