From 18a1db3dc30d7fb0f8e984e559efa84006003eec Mon Sep 17 00:00:00 2001 From: Muhammad Hewedy Date: Thu, 18 Jun 2020 19:53:16 +0300 Subject: [PATCH] use update instead of modify to conform with docker API --- README.md | 2 +- cmd/{modify.go => update.go} | 21 +++++++++++---------- 2 files changed, 12 insertions(+), 11 deletions(-) rename cmd/{modify.go => update.go} (78%) diff --git a/README.md b/README.md index 87790e3..48bdc3f 100644 --- a/README.md +++ b/README.md @@ -93,7 +93,6 @@ Available Commands: help Help about any command images List remote and cached images ip Show IP address for a running VM - modify Modify a VM HW specs (cpus, memory) mount Mount local filesystem inside the VM port Forward port(s) from a VM to host ps List VMs @@ -103,6 +102,7 @@ Available Commands: start Start one or more stopped VMs stop Stop one or more running VMs tag Add or remove tag to a VM + update Update configuration of a VM Flags: -h, --help help for vermin diff --git a/cmd/modify.go b/cmd/update.go similarity index 78% rename from cmd/modify.go rename to cmd/update.go index 6ec8842..c40b39d 100644 --- a/cmd/modify.go +++ b/cmd/update.go @@ -23,15 +23,16 @@ import ( "os" ) -// modifyCmd represents the modify command -var modifyCmd = &cobra.Command{ - Use: "modify", - Short: "Modify a VM HW specs (cpus, memory)", - Long: "Modify a VM HW specs (cpus, memory)", +// updateCmd represents the update command +var updateCmd = &cobra.Command{ + Use: "update", + Aliases: []string{"modify"}, + Short: "Update configuration of a VM", + Long: "Update configuration of a VM", Example: ` To change the VM to use 2 cores and 512MB memory -$ vermin modify vm_01 --cpus 2 --mem 512 +$ vermin update vm_01 --cpus 2 --mem 512 `, Run: func(cmd *cobra.Command, args []string) { vmName := args[0] @@ -65,16 +66,16 @@ $ vermin modify vm_01 --cpus 2 --mem 512 } func init() { - rootCmd.AddCommand(modifyCmd) + rootCmd.AddCommand(updateCmd) // Here you will define your flags and configuration settings. // Cobra supports Persistent Flags which will work for this command // and all subcommands, e.g.: - // modifyCmd.PersistentFlags().String("foo", "", "A help for foo") + // updateCmd.PersistentFlags().String("foo", "", "A help for foo") // Cobra supports local flags which will only run when this command // is called directly, e.g.: - modifyCmd.Flags().IntP("cpus", "c", 0, "Number of cpu cores") - modifyCmd.Flags().IntP("mem", "m", 0, "Memory size in mega bytes") + updateCmd.Flags().IntP("cpus", "c", 0, "Number of cpu cores") + updateCmd.Flags().IntP("mem", "m", 0, "Memory size in mega bytes") }