Compare commits

...

2 commits

Author SHA1 Message Date
de8ff77d05
creating a status 2024-07-04 17:29:27 +01:00
ac34cb98e7
media and media attachments 2024-07-04 13:42:03 +01:00
3 changed files with 106 additions and 14 deletions

BIN
assets/images/created_poll.png (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -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.<br>Here this should be `status`. | |
| `content` | string | false | The content of the status.<br>This flag takes precedence over `from-file`.| |
| `content-type` | string | false | The format that the content is created in.<br>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.<br>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.<br>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.<br>Valid values are `public`, `private`, `unlisted`, `mutuals_only` and `direct`.<br>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
@ -618,10 +666,46 @@ Prints a list of statuses from a timeline.
| `tag` | string | false | The hashtag you want to view.<br>This is only required if `timeline-category` is set to `tag`. | |
| `limit` | integer | false | The maximum number of statuses to print. | 20 |
## Media Attachment
### View media attachment
Prints information about a given media attachment that you own.
You can only see information about the media attachment that you own.
```
enbas show --type media-attachment --attachment-id 01J0N0RQSJ7CFGKHA30F7GBQXT
```
| flag | type | required | description | default |
|------|------|----------|-------------|---------|
| `type` | string | true | The resource you want to view.<br>Here this should be `media`. | |
| `attachment-id` | string | true | The ID of the media attachment to view. | |
## Media
### View media from a status
Downloads and opens media attachment(s) from a status.
Enbas currently supports viewing images and videos.
The media is downloaded to your cache directory before Enbas opens it with your preferred media player.
In order to view images and videos, you must specify your image viewer and
video player in your configuration file respectively.
See the [Configuration reference page](configuration.md#integration) on how to set up integration with
your media players.
```
enbas show --type media --from status --status-id 01J0N11V4V7PWH0DDRAVT7TCFK --attachment-id 01J0N0RQSJ7CFGKHA30F7GBQXT
```
| flag | type | required | description | default |
|------|------|----------|-------------|---------|
| `type` | string | true | The resource you want to view.<br>Here this should be `media`. | |
| `from` | string | true | The resource you want to view the media from.<br>Here this should be `status`. | |
| `status-id` | string | true | The ID of the status that you want to view the media from. | |
| `attachment-id` | string | true | The ID of the media attachment to download and view.<br>Use this flag multiple times to specify multiple media attachments. | |
## Bookmarks
### View your bookmarks

View file

@ -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