Compare commits
8 commits
03beb6ab30
...
cfe6fe3e8d
Author | SHA1 | Date | |
---|---|---|---|
cfe6fe3e8d | |||
3ef3e22489 | |||
62f49bd8bc | |||
0f773e28fd | |||
787101d860 | |||
a8e818c4dd | |||
91784a9d08 | |||
64c1dbcf51 |
5 changed files with 17 additions and 161 deletions
114
docs/manual.md
114
docs/manual.md
|
@ -21,16 +21,14 @@ SPDX-License-Identifier: CC-BY-4.0
|
|||
- [View an account](#view-an-account)
|
||||
- [Follow an account](#follow-an-account)
|
||||
- [Unfollow an account](#unfollow-an-account)
|
||||
- [Show an account's followers](#show-an-accounts-followers)
|
||||
- [Show account's followings](#show-accounts-followings)
|
||||
- [Show followers of an account](#show-followers-of-an-account)
|
||||
- [Show who an account is following](#show-who-an-account-is-following)
|
||||
- [Block an account](#block-an-account)
|
||||
- [Unblock an account](#unblock-an-account)
|
||||
- [View blocked accounts](#view-blocked-accounts)
|
||||
- [Mute an account](#mute-an-account)
|
||||
- [Unmute an account](#unmute-an-account)
|
||||
- [View muted accounts](#view-muted-accounts)
|
||||
- [Add a private note to an account](#add-a-private-note-to-an-account)
|
||||
- [Remove the private note from an account](#remove-the-private-note-from-an-account)
|
||||
- [Follow requests](#follow-requests)
|
||||
- [View your follow requests](#view-your-follow-requests)
|
||||
- [Accept a follow request](#accept-a-follow-request)
|
||||
|
@ -43,7 +41,6 @@ SPDX-License-Identifier: CC-BY-4.0
|
|||
- [Un-boost (Un-repost) a status](#un-boost-un-repost-a-status)
|
||||
- [Like a status](#like-a-status)
|
||||
- [Unlike a status](#unlike-a-status)
|
||||
- [View a list of statuses that you've liked](#view-a-list-of-statuses-that-youve-liked)
|
||||
- [Mute a status](#mute-a-status)
|
||||
- [Unmute a status](#unmute-a-status)
|
||||
- [Polls](#polls)
|
||||
|
@ -135,7 +132,7 @@ enbas whoami
|
|||
|
||||
### View your own account
|
||||
|
||||
Prints the information from your own account.
|
||||
Print the information of your own account.
|
||||
|
||||
```
|
||||
enbas show --type account --my-account
|
||||
|
@ -164,7 +161,7 @@ enbas show --type account --account-name @name@example.social
|
|||
|
||||
### Follow an account
|
||||
|
||||
Sends a follow request to the account you want to follow.
|
||||
Send a follow request to the account you want to follow.
|
||||
|
||||
```
|
||||
enbas follow --type account --account-name @name@example.social
|
||||
|
@ -179,7 +176,7 @@ enbas follow --type account --account-name @name@example.social
|
|||
|
||||
### Unfollow an account
|
||||
|
||||
Unfollows the account that you are currently following.
|
||||
Unfollow the account that you are currently following.
|
||||
If you have a follow request pending for the account in question,
|
||||
performing an unfollow action will remove said follow request.
|
||||
|
||||
|
@ -194,39 +191,11 @@ enbas unfollow --type account --account-name @name@example.social
|
|||
|
||||
### Show an account's followers
|
||||
|
||||
- View followers of your own account.
|
||||
```
|
||||
enbas show --type followers --from account --my-account
|
||||
```
|
||||
- View followers of another account.
|
||||
```
|
||||
enbas show --type followers --from account --account-name @name@example.social
|
||||
```
|
||||
|
||||
| flag | type | required | description | default |
|
||||
|------|------|----------|-------------|---------|
|
||||
| `type` | string | true | The resource you want to view. Here this should be `followers`. | |
|
||||
| `from` | string | true | The resource you want to view followers from.<br>Here this should be `account`. | |
|
||||
| `my-account` | boolean | false | Set to `true` to view followers from your own account.<br>This takes precendence over `account-name`.| false |
|
||||
| `account-name` | string | true | The name of the account to get the followers from. | |
|
||||
_TODO: provide instructions after updated implementation_
|
||||
|
||||
### Show account's followings
|
||||
|
||||
- View the accounts that you are following.
|
||||
```
|
||||
enbas show --type following --from account --my-account
|
||||
```
|
||||
- View the accounts that another account is following.
|
||||
```
|
||||
enbas show --type following --from account --account-name @name@example.social
|
||||
```
|
||||
|
||||
| flag | type | required | description | default |
|
||||
|------|------|----------|-------------|---------|
|
||||
| `type` | string | true | The resource you want to view. Here this should be `following`. | |
|
||||
| `from` | string | true | The resource you want to view the followings from.<br>Here this should be `account`. | |
|
||||
| `my-account` | boolean | false | Set to `true` to view the list from your own account.<br>This takes precendence over `account-name`.| false |
|
||||
| `account-name` | string | true | The name of the account to get the list from. | |
|
||||
_TODO: provide instructions after updated implementation_
|
||||
|
||||
### Block an account
|
||||
|
||||
|
@ -344,8 +313,6 @@ enbas show --type follow-request
|
|||
|
||||
### Accept a follow request
|
||||
|
||||
Accepts the request from the account that wants to follow you.
|
||||
|
||||
```
|
||||
enbas accept --type follow-request --account-name @person.example.social
|
||||
```
|
||||
|
@ -357,8 +324,6 @@ enbas accept --type follow-request --account-name @person.example.social
|
|||
|
||||
### Reject a follow request
|
||||
|
||||
Rejects the request from the account that wants to follow you.
|
||||
|
||||
```
|
||||
enbas reject --type follow-request --account-name @person.example.social
|
||||
```
|
||||
|
@ -384,72 +349,19 @@ _Not yet supported_
|
|||
|
||||
### Boost (Repost) a status
|
||||
|
||||
To boost a status, simply add a `boost` to it.
|
||||
|
||||
```
|
||||
enbas add --type boost --to status --status-id 01J17FH1KD9CN6J9Q01011NE0D
|
||||
```
|
||||
|
||||
| flag | type | required | description | default |
|
||||
|------|------|----------|-------------|---------|
|
||||
| `type` | string | true | The resource you want to add.<br>Here this should be `boost`. | |
|
||||
| `to` | string | true | The resource you want to add the boost to.<br>Here this should be `status`. | |
|
||||
| `status-id` | string | true | The ID of the status that you want to boost. | |
|
||||
To boost a status you simply add a `boost` to it.
|
||||
|
||||
### Un-boost (Un-repost) a status
|
||||
|
||||
To un-boost a status that you've boosted, simply remove the `boost` from it.
|
||||
|
||||
```
|
||||
enbas remove --type boost --from status --status-id 01J17FH1KD9CN6J9Q01011NE0D
|
||||
```
|
||||
|
||||
| flag | type | required | description | default |
|
||||
|------|------|----------|-------------|---------|
|
||||
| `type` | string | true | The resource you want to add.<br>Here this should be `boost`. | |
|
||||
| `from` | string | true | The resource you want to remove the boost from.<br>Here this should be `status`. | |
|
||||
| `status-id` | string | true | The ID of the status that you want to un-boost. | |
|
||||
To un-boost a status that you've boosted you simply remove the `boost` from it.
|
||||
|
||||
### Like a status
|
||||
|
||||
To like (favourite) a status, simply add a `like` or a `star` to it.
|
||||
|
||||
```
|
||||
enbas add --type star --to status --status-id 01J17FH1KD9CN6J9Q01011NE0D
|
||||
```
|
||||
|
||||
| flag | type | required | description | default |
|
||||
|------|------|----------|-------------|---------|
|
||||
| `type` | string | true | The resource you want to add.<br>Here this should either be `like` or `star`. | |
|
||||
| `to` | string | true | The resource you want to like.<br>Here this should be `status`. | |
|
||||
| `status-id` | string | true | The ID of the status that you want to like. | |
|
||||
To like (favourite) a status you simply add a `like` or a `star` to it.
|
||||
|
||||
### Unlike a status
|
||||
|
||||
To unlike (un-favourite) a status that you've previously liked, simply remove the `like` or `star` from it.
|
||||
|
||||
```
|
||||
enbas remove --type star --from status --status-id 01J17FH1KD9CN6J9Q01011NE0D
|
||||
```
|
||||
|
||||
| flag | type | required | description | default |
|
||||
|------|------|----------|-------------|---------|
|
||||
| `type` | string | true | The resource you want to add.<br>Here this should either be `like` or `star`. | |
|
||||
| `from` | string | true | The resource you want to remove the like from.<br>Here this should be `status`. | |
|
||||
| `status-id` | string | true | The ID of the status that you want to remove the like from. | |
|
||||
|
||||
### View a list of statuses that you've liked
|
||||
|
||||
Prints the list of statuses that you've liked.
|
||||
|
||||
```
|
||||
enbas show --type liked
|
||||
```
|
||||
|
||||
| flag | type | required | description | default |
|
||||
|------|------|----------|-------------|---------|
|
||||
| `type` | string | true | The resource you want to view.<br>Here this should either be `liked` or `starred`. | |
|
||||
| `limit` | integer | false | The maximum number of statuses to print. | 20 |
|
||||
To unlike (un-favourite) a status that you've previously liked you simply remove the `like` or `star` from it.
|
||||
|
||||
### Mute a status
|
||||
|
||||
|
@ -483,7 +395,7 @@ enbas show --type poll --poll-id 01J0CEEZBZ6E6AYQSJPHCQYBDA
|
|||
Add your vote(s) to a poll.
|
||||
|
||||
```
|
||||
enbas add --type vote --to poll --poll-id 01J1TVJ705VV3VP02FVVBSMX7E --vote 3
|
||||
enbas add --type vote --to poll --poll-id 01J1TVJ705VV3VP02FVVBSMX7E --choose 3
|
||||
```
|
||||
|
||||
| flag | type | required | description | default |
|
||||
|
@ -491,7 +403,7 @@ enbas add --type vote --to poll --poll-id 01J1TVJ705VV3VP02FVVBSMX7E --vote 3
|
|||
| `type` | string | true | The resource you want to add.<br>Here this should be `vote`. | |
|
||||
| `to` | string | true | The resource you want to add the vote to.<br>Here this should be `poll`. | |
|
||||
| `poll-id` | string | true | The ID of the poll you want to add the votes to. | |
|
||||
| `vote` | int | true | The ID of the option that you want to vote for.<br>You can use this flag multiple times to vote for more than one option if the poll allows multiple choices. | |
|
||||
| `choose` | int | true | The ID of the option that you want to vote for.<br>You can use this flag multiple times to vote for more than one option if the poll allows multiple choices. | |
|
||||
|
||||
## Lists
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ func NewAddExecutor(printer *printer.Printer, config *config.Config, name, summa
|
|||
addExe.StringVar(&addExe.content, flagContent, "", "The content of the resource")
|
||||
addExe.StringVar(&addExe.pollID, flagPollID, "", "The ID of the poll")
|
||||
addExe.Var(&addExe.accountNames, flagAccountName, "The name of the account")
|
||||
addExe.Var(&addExe.choices, flagVote, "Add a vote to an option in a poll")
|
||||
addExe.Var(&addExe.choices, flagChoose, "Specify your choice ")
|
||||
|
||||
addExe.Usage = commandUsageFunc(name, summary, addExe.FlagSet)
|
||||
|
||||
|
@ -270,7 +270,7 @@ func (a *AddExecutor) addToPoll(gtsClient *client.Client) error {
|
|||
|
||||
func (a *AddExecutor) addVoteToPoll(gtsClient *client.Client) error {
|
||||
if len(a.choices) == 0 {
|
||||
return errors.New("please use --" + flagVote + " to make a choice in this poll")
|
||||
return errors.New("please use --" + flagChoose + " to make a choice in this poll")
|
||||
}
|
||||
|
||||
poll, err := gtsClient.GetPoll(a.pollID)
|
||||
|
|
|
@ -52,19 +52,6 @@ func (e UnsupportedRemoveOperationError) Error() string {
|
|||
"' is not supported"
|
||||
}
|
||||
|
||||
type UnsupportedShowOperationError struct {
|
||||
ResourceType string
|
||||
ShowFromResourceType string
|
||||
}
|
||||
|
||||
func (e UnsupportedShowOperationError) Error() string {
|
||||
return "showing '" +
|
||||
e.ResourceType +
|
||||
"' from '" +
|
||||
e.ShowFromResourceType +
|
||||
"' is not supported"
|
||||
}
|
||||
|
||||
type EmptyContentError struct {
|
||||
ResourceType string
|
||||
Hint string
|
||||
|
|
|
@ -16,6 +16,7 @@ const (
|
|||
flagAccountName = "account-name"
|
||||
flagAttachmentID = "attachment-id"
|
||||
flagBrowser = "browser"
|
||||
flagChoose = "choose"
|
||||
flagContentType = "content-type"
|
||||
flagContent = "content"
|
||||
flagEnableFederation = "enable-federation"
|
||||
|
@ -51,7 +52,6 @@ const (
|
|||
flagTo = "to"
|
||||
flagType = "type"
|
||||
flagVisibility = "visibility"
|
||||
flagVote = "vote"
|
||||
)
|
||||
|
||||
type MultiStringFlagValue []string
|
||||
|
|
|
@ -287,26 +287,6 @@ func (s *ShowExecutor) showLists(gtsClient *client.Client) error {
|
|||
}
|
||||
|
||||
func (s *ShowExecutor) showFollowers(gtsClient *client.Client) error {
|
||||
if s.fromResourceType == "" {
|
||||
return FlagNotSetError{flagText: flagFrom}
|
||||
}
|
||||
|
||||
funcMap := map[string]func(*client.Client) error{
|
||||
resourceAccount: s.showFollowersFromAccount,
|
||||
}
|
||||
|
||||
doFunc, ok := funcMap[s.fromResourceType]
|
||||
if !ok {
|
||||
return UnsupportedShowOperationError{
|
||||
ResourceType: s.resourceType,
|
||||
ShowFromResourceType: s.fromResourceType,
|
||||
}
|
||||
}
|
||||
|
||||
return doFunc(gtsClient)
|
||||
}
|
||||
|
||||
func (s *ShowExecutor) showFollowersFromAccount(gtsClient *client.Client) error {
|
||||
accountID, err := getAccountID(gtsClient, s.myAccount, s.accountName, s.config.CredentialsFile)
|
||||
if err != nil {
|
||||
return fmt.Errorf("received an error while getting the account ID: %w", err)
|
||||
|
@ -327,26 +307,6 @@ func (s *ShowExecutor) showFollowersFromAccount(gtsClient *client.Client) error
|
|||
}
|
||||
|
||||
func (s *ShowExecutor) showFollowing(gtsClient *client.Client) error {
|
||||
if s.fromResourceType == "" {
|
||||
return FlagNotSetError{flagText: flagFrom}
|
||||
}
|
||||
|
||||
funcMap := map[string]func(*client.Client) error{
|
||||
resourceAccount: s.showFollowingFromAccount,
|
||||
}
|
||||
|
||||
doFunc, ok := funcMap[s.fromResourceType]
|
||||
if !ok {
|
||||
return UnsupportedShowOperationError{
|
||||
ResourceType: s.resourceType,
|
||||
ShowFromResourceType: s.fromResourceType,
|
||||
}
|
||||
}
|
||||
|
||||
return doFunc(gtsClient)
|
||||
}
|
||||
|
||||
func (s *ShowExecutor) showFollowingFromAccount(gtsClient *client.Client) error {
|
||||
accountID, err := getAccountID(gtsClient, s.myAccount, s.accountName, s.config.CredentialsFile)
|
||||
if err != nil {
|
||||
return fmt.Errorf("received an error while getting the account ID: %w", err)
|
||||
|
@ -489,10 +449,7 @@ func (s *ShowExecutor) showMedia(gtsClient *client.Client) error {
|
|||
|
||||
doFunc, ok := funcMap[s.fromResourceType]
|
||||
if !ok {
|
||||
return UnsupportedShowOperationError{
|
||||
ResourceType: s.resourceType,
|
||||
ShowFromResourceType: s.fromResourceType,
|
||||
}
|
||||
return fmt.Errorf("do not support viewing media from %s", s.fromResourceType)
|
||||
}
|
||||
|
||||
return doFunc(gtsClient)
|
||||
|
|
Loading…
Reference in a new issue