-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
/
Copy pathconfig.go
44 lines (39 loc) · 801 Bytes
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package cli
import (
"fmt"
"os"
"time"
"github.com/spf13/cobra"
)
// configCmd represents the config command
var configCmd = &cobra.Command{
Use: "config [export|migrate|edit]",
Short: "Interact with the config",
Long: `Interact with the config.
You can export, migrate or edit the config.`,
ValidArgs: []string{
"export",
"migrate",
"edit",
"get",
},
Args: NoArgsOrOneValidArg,
Run: func(cmd *cobra.Command, args []string) {
if len(args) == 0 {
_ = cmd.Help()
return
}
switch args[0] {
case "edit":
editFileWithEditor(os.Getenv("POSH_THEME"))
case "get":
// only here for backwards compatibility
fmt.Print(time.Now().UnixNano() / 1000000)
default:
_ = cmd.Help()
}
},
}
func init() { //nolint:gochecknoinits
RootCmd.AddCommand(configCmd)
}