diff --git a/assets/images/created_poll.png b/assets/images/created_poll.png new file mode 100644 index 0000000..2e3fdaa --- /dev/null +++ b/assets/images/created_poll.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:56e80384a81f1712396721d77eb0ce925b8a2d7899656729d5f7e6b474a60ba0 +size 849307 diff --git a/docs/manual.md b/docs/manual.md index 0e312fa..c94fb3c 100644 --- a/docs/manual.md +++ b/docs/manual.md @@ -60,6 +60,8 @@ SPDX-License-Identifier: CC-BY-4.0 - [Remove accounts from a list](#remove-accounts-from-a-list) - [Timelines](#timelines) - [View a timeline](#view-a-timeline) +- [Media Attachment](#media-attachment) + - [View media attachment](#view-media-attachment) - [Media](#media) - [View media from a status](#view-media-from-a-status) - [Bookmarks](#bookmarks) @@ -374,9 +376,55 @@ enbas reject --type follow-request --account-name @person.example.social ### Create a status -- Create a one line status -- Create a status from a file +- Create a simple status that is publicly visible. + ``` + enbas create --type status --content-type plain --visibility public --content "Hello, Fediverse!" + ``` +- Create a private status from a file. + ``` + enbas create --type status --content-type markdown --visibility private --from-file status.md + ``` - Create a status with a poll + ``` + enbas create \ + --type status \ + --content-type plain \ + --visibility public \ + --content "The age-old question: which text editor do you prefer?" \ + --add-poll \ + --poll-allows-multiple-choices=false \ + --poll-expires-in 168h \ + --poll-option "emacs" \ + --poll-option "vim/neovim" \ + --poll-option "nano" \ + --poll-option "other (please comment)" + ``` + ![A screenshot of a status with a poll](../assets/images/created_poll.png "A status with a poll") + +| flag | type | required | description | default | +|------|------|----------|-------------|---------| +| `type` | string | true | The resource you want to create.
Here this should be `status`. | | +| `content` | string | false | The content of the status.
This flag takes precedence over `from-file`.| | +| `content-type` | string | false | The format that the content is created in.
Valid values are `plain` and `markdown`. | plain | +| `enable-reposts` | boolean | false | The status can be reposted (boosted) by others. | true | +| `enable-federation` | boolean | false | The status can be federated beyond the local timelines. | true | +| `enable-likes` | boolean | false | The status can be liked (favourtied). | true | +| `enable-replies` | boolean | false | The status can be replied to. | true | +| `from-file` | string | false | The path to the file where to read the contents of the status from. | | +| `language` | string | false | The ISO 639 language code that the status is written in.
If this is not specified then the default language from your posting preferences will be used. | | +| `sensitive` | string | false | The status should be marked as sensitive.
If this is not specified then the default sensitivity from your posting preferences will be used. | | +| `spoiler-text` | string | false | The text to display as the status' warning or subject. | | +| `visibility` | string | false | The visibility of the status.
Valid values are `public`, `private`, `unlisted`, `mutuals_only` and `direct`.
If this is not specified then the default visibility from your posting preferences will be used. | | + +Additional flags for polls. + +| flag | type | required | description | default | +|------|------|----------|-------------|---------| +| `add-poll` | boolean | false | Set to `true` to add a poll to the status. | false | +| `poll-allows-multiple-choices` | boolean | false | Set to `true` to allow users to make multiple choices. | false | +| `poll-hides-vote-counts` | boolean | false | Set to `true` to hide the vote count until the poll is closed. | false | +| `poll-option` | string | true | An option in the poll. Use this flag multiple times to set multiple options. | | +| `poll-expires-in` | string | false | The duration in which the poll is open for. | | ### Delete a status diff --git a/internal/executor/create.go b/internal/executor/create.go index 856b261..8c98558 100644 --- a/internal/executor/create.go +++ b/internal/executor/create.go @@ -50,25 +50,19 @@ func NewCreateExecutor(printer *printer.Printer, config *config.Config, name, su config: config, } + createExe.StringVar(&createExe.resourceType, flagType, "", "Specify the type of resource to create") + + // Flags for statuses createExe.BoolVar(&createExe.boostable, flagEnableReposts, true, "Specify if the status can be reposted/boosted by others") - createExe.BoolVar(&createExe.federated, flagEnableFederation, true, "Specify if the status can be federated beyond the local timelines") - createExe.BoolVar(&createExe.likeable, flagEnableLikes, true, "Specify if the status can be liked/favourited") - createExe.BoolVar(&createExe.replyable, flagEnableReplies, true, "Specify if the status can be replied to") - createExe.BoolVar(&createExe.pollAllowsMultipleChoices, flagPollAllowsMultipleChoices, false, "The poll allows viewers to make multiple choices in the poll") - createExe.BoolVar(&createExe.pollHidesVoteCounts, flagPollHidesVoteCounts, false, "The poll will hide the vote count until it is closed") - createExe.BoolVar(&createExe.addPoll, flagAddPoll, false, "Add a poll to the status") createExe.StringVar(&createExe.content, flagContent, "", "The content of the status to create") createExe.StringVar(&createExe.contentType, flagContentType, "plain", "The type that the contents should be parsed from (valid values are plain and markdown)") + createExe.BoolVar(&createExe.federated, flagEnableFederation, true, "Specify if the status can be federated beyond the local timelines") createExe.StringVar(&createExe.fromFile, flagFromFile, "", "The file path where to read the contents from") createExe.StringVar(&createExe.language, flagLanguage, "", "The ISO 639 language code for this status") + createExe.BoolVar(&createExe.likeable, flagEnableLikes, true, "Specify if the status can be liked/favourited") + createExe.BoolVar(&createExe.replyable, flagEnableReplies, true, "Specify if the status can be replied to") createExe.StringVar(&createExe.spoilerText, flagSpoilerText, "", "The text to display as the status' warning or subject") createExe.StringVar(&createExe.visibility, flagVisibility, "", "The visibility of the posted status") - createExe.StringVar(&createExe.resourceType, flagType, "", "Specify the type of resource to create") - createExe.StringVar(&createExe.listTitle, flagListTitle, "", "Specify the title of the list") - createExe.StringVar(&createExe.listRepliesPolicy, flagListRepliesPolicy, "list", "Specify the policy of the replies for this list (valid values are followed, list and none)") - createExe.Var(&createExe.pollOptions, flagPollOption, "A poll option. Use this multiple times to set multiple options") - createExe.Var(&createExe.pollExpiresIn, flagPollExpiresIn, "The duration in which the poll is open for") - createExe.BoolFunc(flagSensitive, "Specify if the status should be marked as sensitive", func(value string) error { boolVal, err := strconv.ParseBool(value) if err != nil { @@ -81,6 +75,17 @@ func NewCreateExecutor(printer *printer.Printer, config *config.Config, name, su return nil }) + // Flags specifically for polls + createExe.BoolVar(&createExe.addPoll, flagAddPoll, false, "Add a poll to the status") + createExe.BoolVar(&createExe.pollAllowsMultipleChoices, flagPollAllowsMultipleChoices, false, "The poll allows viewers to make multiple choices in the poll") + createExe.BoolVar(&createExe.pollHidesVoteCounts, flagPollHidesVoteCounts, false, "The poll will hide the vote count until it is closed") + createExe.Var(&createExe.pollOptions, flagPollOption, "A poll option. Use this multiple times to set multiple options") + createExe.Var(&createExe.pollExpiresIn, flagPollExpiresIn, "The duration in which the poll is open for") + + // Flags for lists + createExe.StringVar(&createExe.listTitle, flagListTitle, "", "Specify the title of the list") + createExe.StringVar(&createExe.listRepliesPolicy, flagListRepliesPolicy, "list", "Specify the policy of the replies for this list (valid values are followed, list and none)") + createExe.Usage = commandUsageFunc(name, summary, createExe.FlagSet) return &createExe