-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
replace the old pman interactive ui with a more minimalist one
this removes the need to specify pman ls --c as that is now the default pman ls behaviour
- Loading branch information
1 parent
90ffcb3
commit b922a87
Showing
4 changed files
with
20 additions
and
287 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,38 @@ | ||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
"strings" | ||
|
||
"github.com/spf13/cobra" | ||
|
||
"github.com/theredditbandit/pman/pkg/db" | ||
"github.com/theredditbandit/pman/pkg/ui" | ||
"github.com/theredditbandit/pman/pkg/utils" | ||
) | ||
|
||
// iCmd represents the interactive command | ||
var iCmd = &cobra.Command{ | ||
Use: "i", | ||
Short: "Launches pman in interactive mode", | ||
Aliases: []string{"interactive", "iteractive"}, | ||
RunE: func(_ *cobra.Command, _ []string) error { | ||
return ui.Tui() | ||
RunE: func(cmd *cobra.Command, _ []string) error { | ||
filterFlag, _ := cmd.Flags().GetString("f") | ||
refreshLastEditTime, _ := cmd.Flags().GetBool("r") | ||
data, err := db.GetAllRecords(db.DBName, StatusBucket) | ||
if err != nil { | ||
return err | ||
} | ||
if filterFlag != "" { | ||
fmt.Println("Filtering by status : ", filterFlag) | ||
data = utils.FilterByStatuses(data, strings.Split(filterFlag, ",")) | ||
} | ||
return ui.RenderInteractiveTable(data, refreshLastEditTime) | ||
}, | ||
} | ||
|
||
func init() { | ||
rootCmd.AddCommand(iCmd) | ||
iCmd.Flags().String("f", "", "Filter projects by status. Usage : pman ls --f <status1[,status2]>") | ||
iCmd.Flags().Bool("r", false, "Refresh Last Edited time: pman ls --r") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.