summaryrefslogtreecommitdiff
path: root/list.go
diff options
context:
space:
mode:
authorLoyalsoldier <[email protected]>2024-07-08 13:54:29 +0800
committerLoyalsoldier <[email protected]>2024-07-08 14:23:41 +0800
commit56ddd1bd048e6d42645f36cd473a211dca90b5dc (patch)
tree1832981ab31a2c457992e053f0dd94453ac475f5 /list.go
parent8c55b323a91acff7cc7f839a371ec9510fe60039 (diff)
Refactor: CLI commands
old usage: geoip -l new usage: geoip list old usage: geoip -c config.json new usage: geoip convert -c config.json
Diffstat (limited to 'list.go')
-rw-r--r--list.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/list.go b/list.go
new file mode 100644
index 00000000..1a05bea5
--- /dev/null
+++ b/list.go
@@ -0,0 +1,21 @@
+package main
+
+import (
+ "github.com/Loyalsoldier/geoip/lib"
+ "github.com/spf13/cobra"
+)
+
+func init() {
+ rootCmd.AddCommand(listCmd)
+}
+
+var listCmd = &cobra.Command{
+ Use: "list",
+ Aliases: []string{"l", "ls"},
+ Short: "List all available input and output formats",
+ Run: func(cmd *cobra.Command, args []string) {
+ lib.ListInputConverter()
+ println()
+ lib.ListOutputConverter()
+ },
+}