diff --git a/_awssh b/_awssh index 7731eb3..6785640 100644 --- a/_awssh +++ b/_awssh @@ -7,11 +7,10 @@ _awssh() { '(-p --port)'{-p,--port}'[ssh login port.]' \ '--cache[enable cache a credentials.]' \ '--duration[cache duration.]' \ + '--enable-snapshot[enable snapshot.]' \ '(-c --external-command)'{-c,--external-command}'[feature use.]' \ '(-i --identity-file)'{-i,--identity-file}'[identity file path.]' \ '--profile[use a specific profile from your credential file.]' \ '(-P --publickey)'{-P,--publickey}'[public key file path.]' \ - '--select-profile[select a specific profile from your credential file.]' \ - '--version[version for awssh]' \ - '--completion-zsh[output shell completion code for the zsh.]' + '--select-profile[select a specific profile from your credential file.]' } diff --git a/awssh/cmd/root.go b/awssh/cmd/root.go index b59eb65..53231b3 100644 --- a/awssh/cmd/root.go +++ b/awssh/cmd/root.go @@ -40,7 +40,7 @@ func init() { rootCmd.Flags().Bool("select-profile", false, "select a specific profile from your credential file.") rootCmd.Flags().Bool("cache", false, "enable cache a credentials.") rootCmd.Flags().String("duration", "1 hour", "cache duration.") - rootCmd.Flags().Bool("disable-snapshot", false, "disable snapshot.") + rootCmd.Flags().Bool("enable-snapshot", false, "enable snapshot.") viper.BindPFlags(rootCmd.Flags()) } diff --git a/cli.go b/cli.go index e359589..b2844f8 100644 --- a/cli.go +++ b/cli.go @@ -21,7 +21,7 @@ func Run(cmd *cobra.Command, args []string) (err error) { profile := viper.GetString("profile") cache := viper.GetBool("cache") - disableSnapshot := viper.GetBool("disable-snapshot") + enableSnapshot := viper.GetBool("enable-snapshot") duration, err := duration.Parse(viper.GetString("duration")) if err != nil { return err @@ -46,7 +46,7 @@ func Run(cmd *cobra.Command, args []string) (err error) { } // Get snapshot - if disableSnapshot != true { + if enableSnapshot == true { go func() { if imageId, err := createAMI(ctx, awsSession, instanceID); err != nil { fmt.Printf("Failed to create to auto snapshot. error: %T\n", err)