diff --git a/client/cmd/export.go b/client/cmd/export.go index 9bc0ba5..6baafe0 100644 --- a/client/cmd/export.go +++ b/client/cmd/export.go @@ -15,8 +15,9 @@ import ( ) var exportJsonCmd = &cobra.Command{ - Use: "export-json", - Short: "Export history entries formatted in JSON lines format (as accepted by hishtory import-json, and easily parsable by other tools)", + Use: "export-json", + Short: "Export history entries formatted in JSON lines format (as accepted by hishtory import-json, and easily parsable by other tools)", + GroupID: GROUP_ID_MANAGEMENT, Run: func(cmd *cobra.Command, args []string) { ctx := hctx.MakeContext() err := exportToJson(ctx, os.Stdout) diff --git a/client/cmd/import.go b/client/cmd/import.go index 4bdf76a..5e56212 100644 --- a/client/cmd/import.go +++ b/client/cmd/import.go @@ -17,10 +17,11 @@ import ( ) var importCmd = &cobra.Command{ - Use: "import", - Hidden: true, - Short: "Re-import history entries from your existing shell history", - Long: "Note that you may also pipe commands to be imported in via stdin. For example `history | hishtory import`.", + Use: "import", + GroupID: GROUP_ID_MANAGEMENT, + Hidden: true, + Short: "Re-import history entries from your existing shell history", + Long: "Note that you may also pipe commands to be imported in via stdin. For example `history | hishtory import`.", Run: func(cmd *cobra.Command, args []string) { ctx := hctx.MakeContext() numImported, err := lib.ImportHistory(ctx, true, true) @@ -32,8 +33,9 @@ var importCmd = &cobra.Command{ } var importJsonCmd = &cobra.Command{ - Use: "import-json", - Short: "Import history entries formatted in JSON lines format into hiSHtory", + Use: "import-json", + GroupID: GROUP_ID_MANAGEMENT, + Short: "Import history entries formatted in JSON lines format into hiSHtory", Long: "Data is read from stdin. For example: `cat data.txt | hishtory import-json`.\n\nExample JSON format:\n\n```\n" + "{\"command\":\"echo foo\"}\n" + "{\"command\":\"echo bar\", \"current_working_directory\": \"/tmp/\"}\n" + diff --git a/client/cmd/install.go b/client/cmd/install.go index 1b01989..c287c90 100644 --- a/client/cmd/install.go +++ b/client/cmd/install.go @@ -36,11 +36,13 @@ var ( currentlyInstalledVersion *string ) +var GROUP_ID_INSTALL string = "group_id_install" + var installCmd = &cobra.Command{ - Use: "install", - Hidden: true, - Short: "Copy this binary to ~/.hishtory/ and configure your shell to use it for recording your shell history", - Args: cobra.MaximumNArgs(1), + Use: "install", + Short: "Copy this binary to ~/.hishtory/ and configure your shell to use it for recording your shell history", + GroupID: GROUP_ID_INSTALL, + Args: cobra.MaximumNArgs(1), Run: func(cmd *cobra.Command, args []string) { secretKey := "" if len(args) > 0 { @@ -72,7 +74,7 @@ var installCmd = &cobra.Command{ var initCmd = &cobra.Command{ Use: "init", Short: "Re-initialize hiSHtory with a specified secret key", - GroupID: GROUP_ID_CONFIG, + GroupID: GROUP_ID_INSTALL, Args: cobra.MaximumNArgs(1), Run: func(cmd *cobra.Command, args []string) { db, err := hctx.OpenLocalSqliteDb() @@ -107,8 +109,9 @@ var initCmd = &cobra.Command{ } var uninstallCmd = &cobra.Command{ - Use: "uninstall", - Short: "Completely uninstall hiSHtory and remove your shell history", + Use: "uninstall", + Short: "Completely uninstall hiSHtory and remove your shell history", + GroupID: GROUP_ID_INSTALL, Run: func(cmd *cobra.Command, args []string) { ctx := hctx.MakeContext() fmt.Printf("Are you sure you want to uninstall hiSHtory and delete all locally saved history data [y/N]") diff --git a/client/cmd/root.go b/client/cmd/root.go index 54222cf..64521df 100644 --- a/client/cmd/root.go +++ b/client/cmd/root.go @@ -30,5 +30,6 @@ func init() { rootCmd.AddGroup(&cobra.Group{ID: GROUP_ID_QUERYING, Title: "History Searching"}) rootCmd.AddGroup(&cobra.Group{ID: GROUP_ID_MANAGEMENT, Title: "History Management"}) rootCmd.AddGroup(&cobra.Group{ID: GROUP_ID_CONFIG, Title: "Configuration"}) + rootCmd.AddGroup(&cobra.Group{ID: GROUP_ID_INSTALL, Title: "Installation"}) rootCmd.Version = "v0." + lib.Version } diff --git a/client/cmd/update.go b/client/cmd/update.go index 226b481..d819c19 100644 --- a/client/cmd/update.go +++ b/client/cmd/update.go @@ -22,8 +22,9 @@ import ( ) var updateCmd = &cobra.Command{ - Use: "update", - Short: "Securely update hishtory to the latest version", + Use: "update", + GroupID: GROUP_ID_INSTALL, + Short: "Securely update hishtory to the latest version", Run: func(cmd *cobra.Command, args []string) { lib.CheckFatalError(update(hctx.MakeContext())) },