cmd/toot.go
changeset 71 67e3234c26a9
parent 70 155fdea254c3
child 79 bca27c55be9f
equal deleted inserted replaced
70:155fdea254c3 71:67e3234c26a9
    22 	tootAliasCmd.Flags().StringVar(&statusOpts.spoiler, "spoiler", "", "Spoiler warning (CW)")
    22 	tootAliasCmd.Flags().StringVar(&statusOpts.spoiler, "spoiler", "", "Spoiler warning (CW)")
    23 	tootAliasCmd.Flags().StringVar(&statusOpts.mediaIDs, "media-ids", "", "Comma-separated list of media IDs")
    23 	tootAliasCmd.Flags().StringVar(&statusOpts.mediaIDs, "media-ids", "", "Comma-separated list of media IDs")
    24 	tootAliasCmd.Flags().StringVarP(&statusOpts.mediaFilePath, "file", "f", "", "Media attachment file name")
    24 	tootAliasCmd.Flags().StringVarP(&statusOpts.mediaFilePath, "file", "f", "", "Media attachment file name")
    25 	tootAliasCmd.Flags().StringVar(&statusOpts.textFilePath, "text-file", "", "Text file name (message content)")
    25 	tootAliasCmd.Flags().StringVar(&statusOpts.textFilePath, "text-file", "", "Text file name (message content)")
    26 	tootAliasCmd.Flags().Int64VarP(&statusOpts.inReplyToID, "in-reply-to", "r", 0, "Status ID to reply to")
    26 	tootAliasCmd.Flags().Int64VarP(&statusOpts.inReplyToID, "in-reply-to", "r", 0, "Status ID to reply to")
       
    27 	tootAliasCmd.Flags().BoolVar(&statusOpts.stdin, "stdin", false, "Read message content from standard input")
    27 
    28 
    28 	// Flag completion
    29 	// Flag completion
    29 	annotation := make(map[string][]string)
    30 	annotation := make(map[string][]string)
    30 	annotation[cobra.BashCompCustom] = []string{"__madonctl_visibility"}
    31 	annotation[cobra.BashCompCustom] = []string{"__madonctl_visibility"}
    31 
    32 
    38 	Short:   "Post a message (toot)",
    39 	Short:   "Post a message (toot)",
    39 	Example: `  madonctl toot message
    40 	Example: `  madonctl toot message
    40   madonctl toot --spoiler Warning "Hello, World"
    41   madonctl toot --spoiler Warning "Hello, World"
    41   madonctl status post --media-ids ID1,ID2 "Here are the photos"
    42   madonctl status post --media-ids ID1,ID2 "Here are the photos"
    42   madonctl post --sensitive --file image.jpg Image
    43   madonctl post --sensitive --file image.jpg Image
    43   madonctl toot --text-file message.txt`,
    44   madonctl toot --text-file message.txt
       
    45   echo "Hello from #madonctl" | madonctl toot --visibility unlisted --stdin`,
    44 	RunE: func(cmd *cobra.Command, args []string) error {
    46 	RunE: func(cmd *cobra.Command, args []string) error {
    45 		if err := madonInit(true); err != nil {
    47 		if err := madonInit(true); err != nil {
    46 			return err
    48 			return err
    47 		}
    49 		}
    48 		return statusSubcommandRunE("post", args)
    50 		return statusSubcommandRunE("post", args)