cmd/toot.go
changeset 176 7efbbed5cf3c
parent 168 ce4000ac7294
child 185 564d92b54b00
--- a/cmd/toot.go	Sat Oct 28 19:48:20 2017 +0000
+++ b/cmd/toot.go	Sun Mar 18 23:13:55 2018 +0100
@@ -10,6 +10,7 @@
 
 	"github.com/pkg/errors"
 	"github.com/spf13/cobra"
+	flag "github.com/spf13/pflag"
 	"github.com/spf13/viper"
 
 	"github.com/McKael/madon"
@@ -17,6 +18,8 @@
 
 // toot is a kind of alias for status post
 
+var tootAliasFlags *flag.FlagSet
+
 func init() {
 	RootCmd.AddCommand(tootAliasCmd)
 
@@ -38,7 +41,7 @@
 	tootAliasCmd.Flags().Lookup("visibility").Annotations = annotation
 
 	// This one will be used to check if the options were explicitly set or not
-	updateFlags = tootAliasCmd.Flags()
+	tootAliasFlags = tootAliasCmd.Flags()
 }
 
 var tootAliasCmd = &cobra.Command{
@@ -97,7 +100,9 @@
 	if opt.inReplyToID > 0 {
 		var initialStatus *madon.Status
 		var preserveVis bool
-		if opt.sameVisibility && !updateFlags.Lookup("visibility").Changed {
+		if opt.sameVisibility &&
+			!tootAliasFlags.Lookup("visibility").Changed &&
+			!statusPostFlags.Lookup("visibility").Changed {
 			// Preserve visibility unless the --visibility flag
 			// has been used in the command line.
 			preserveVis = true