Implement 'delete' command for interface removal and refactor 'add' command

This commit is contained in:
tuna2134
2026-06-30 12:22:53 +09:00
parent ff7f594a84
commit ebe437161b
5 changed files with 52 additions and 10 deletions

25
cmd/delete.go Normal file
View File

@@ -0,0 +1,25 @@
/*
Copyright © 2026 Masato Kikuchi <m-kikuchi@neody.ad.jp>
*/
package cmd
import (
"git.neody.ad.jp/tuna2134/etherip-client/utils"
"github.com/spf13/cobra"
)
var DelDevVar string
var deleteCmd = &cobra.Command{
Use: "delete",
Short: "Delete iface",
Long: `Delete iface`,
RunE: func(cmd *cobra.Command, args []string) error {
return utils.DelDev(DelDevVar)
},
}
func init() {
deleteCmd.Flags().StringVarP(&DelDevVar, "devname", "d", "eip0", "削除対象のNICの名前")
rootCmd.AddCommand(deleteCmd)
}