feat: rename create and delete commands to add and del
This commit is contained in:
@@ -16,8 +16,8 @@ import (
|
||||
var cDue, cContent string
|
||||
var cTags, cRels []string
|
||||
|
||||
var createCmd = &cobra.Command{
|
||||
Use: "create <title>", Short: "Create a new node", Args: cobra.ExactArgs(1),
|
||||
var addCmd = &cobra.Command{
|
||||
Use: "add <title>", Short: "Create a new node", Args: cobra.ExactArgs(1),
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
d, err := db.GetDB()
|
||||
if err != nil {
|
||||
@@ -59,10 +59,10 @@ var createCmd = &cobra.Command{
|
||||
}
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(createCmd)
|
||||
addPropertyFlags(createCmd)
|
||||
createCmd.Flags().Set("type", "issue")
|
||||
f := createCmd.Flags()
|
||||
rootCmd.AddCommand(addCmd)
|
||||
addPropertyFlags(addCmd)
|
||||
addCmd.Flags().Set("type", "issue")
|
||||
f := addCmd.Flags()
|
||||
f.StringVar(&cDue, "due", "", "")
|
||||
f.StringVar(&cContent, "content", "", "")
|
||||
f.StringArrayVar(&cTags, "tag", nil, "")
|
||||
@@ -38,8 +38,8 @@ var aliasCmd = &cobra.Command{
|
||||
},
|
||||
}
|
||||
|
||||
var aliasDeleteCmd = &cobra.Command{
|
||||
Use: "delete <name>", Short: "Delete an alias", Args: cobra.ExactArgs(1),
|
||||
var aliasDelCmd = &cobra.Command{
|
||||
Use: "del <name>", Short: "Delete an alias", Args: cobra.ExactArgs(1),
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
if err := cfg.DeleteAlias(args[0]); err != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
@@ -51,6 +51,6 @@ var aliasDeleteCmd = &cobra.Command{
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(aliasCmd)
|
||||
aliasCmd.AddCommand(aliasDeleteCmd)
|
||||
aliasCmd.AddCommand(aliasDelCmd)
|
||||
aliasCmd.Flags().StringVar(&aliasDesc, "desc", "", "description for the alias")
|
||||
}
|
||||
|
||||
@@ -13,8 +13,8 @@ import (
|
||||
)
|
||||
|
||||
var dForce bool
|
||||
var deleteCmd = &cobra.Command{
|
||||
Use: "delete <id>", Short: "Delete a node", Args: cobra.ExactArgs(1),
|
||||
var delCmd = &cobra.Command{
|
||||
Use: "del <id>", Short: "Delete a node", Args: cobra.ExactArgs(1),
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
d, err := db.GetDB()
|
||||
if err != nil {
|
||||
@@ -46,6 +46,6 @@ var deleteCmd = &cobra.Command{
|
||||
}
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(deleteCmd)
|
||||
deleteCmd.Flags().BoolVarP(&dForce, "force", "f", false, "")
|
||||
rootCmd.AddCommand(delCmd)
|
||||
delCmd.Flags().BoolVarP(&dForce, "force", "f", false, "")
|
||||
}
|
||||
Reference in New Issue
Block a user