Compare commits
14 commits
cfe6fe3e8d
...
03beb6ab30
Author | SHA1 | Date | |
---|---|---|---|
03beb6ab30 | |||
3324cd7a4c | |||
ab415816af | |||
9a2e4724ec | |||
084814c6d1 | |||
56ea3f55c8 | |||
4911a7c464 | |||
25b7e64228 | |||
c1d1aa7759 | |||
124b4dc8e8 | |||
35666f39b7 | |||
f64f8a43a6 | |||
a8aeec2fbf | |||
5ec1cc0e18 |
5 changed files with 161 additions and 17 deletions
114
docs/manual.md
114
docs/manual.md
|
@ -21,14 +21,16 @@ SPDX-License-Identifier: CC-BY-4.0
|
||||||
- [View an account](#view-an-account)
|
- [View an account](#view-an-account)
|
||||||
- [Follow an account](#follow-an-account)
|
- [Follow an account](#follow-an-account)
|
||||||
- [Unfollow an account](#unfollow-an-account)
|
- [Unfollow an account](#unfollow-an-account)
|
||||||
- [Show followers of an account](#show-followers-of-an-account)
|
- [Show an account's followers](#show-an-accounts-followers)
|
||||||
- [Show who an account is following](#show-who-an-account-is-following)
|
- [Show account's followings](#show-accounts-followings)
|
||||||
- [Block an account](#block-an-account)
|
- [Block an account](#block-an-account)
|
||||||
- [Unblock an account](#unblock-an-account)
|
- [Unblock an account](#unblock-an-account)
|
||||||
- [View blocked accounts](#view-blocked-accounts)
|
- [View blocked accounts](#view-blocked-accounts)
|
||||||
- [Mute an account](#mute-an-account)
|
- [Mute an account](#mute-an-account)
|
||||||
- [Unmute an account](#unmute-an-account)
|
- [Unmute an account](#unmute-an-account)
|
||||||
- [View muted accounts](#view-muted-accounts)
|
- [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)
|
- [Follow requests](#follow-requests)
|
||||||
- [View your follow requests](#view-your-follow-requests)
|
- [View your follow requests](#view-your-follow-requests)
|
||||||
- [Accept a follow request](#accept-a-follow-request)
|
- [Accept a follow request](#accept-a-follow-request)
|
||||||
|
@ -41,6 +43,7 @@ SPDX-License-Identifier: CC-BY-4.0
|
||||||
- [Un-boost (Un-repost) a status](#un-boost-un-repost-a-status)
|
- [Un-boost (Un-repost) a status](#un-boost-un-repost-a-status)
|
||||||
- [Like a status](#like-a-status)
|
- [Like a status](#like-a-status)
|
||||||
- [Unlike a status](#unlike-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)
|
- [Mute a status](#mute-a-status)
|
||||||
- [Unmute a status](#unmute-a-status)
|
- [Unmute a status](#unmute-a-status)
|
||||||
- [Polls](#polls)
|
- [Polls](#polls)
|
||||||
|
@ -132,7 +135,7 @@ enbas whoami
|
||||||
|
|
||||||
### View your own account
|
### View your own account
|
||||||
|
|
||||||
Print the information of your own account.
|
Prints the information from your own account.
|
||||||
|
|
||||||
```
|
```
|
||||||
enbas show --type account --my-account
|
enbas show --type account --my-account
|
||||||
|
@ -161,7 +164,7 @@ enbas show --type account --account-name @name@example.social
|
||||||
|
|
||||||
### Follow an account
|
### Follow an account
|
||||||
|
|
||||||
Send a follow request to the account you want to follow.
|
Sends a follow request to the account you want to follow.
|
||||||
|
|
||||||
```
|
```
|
||||||
enbas follow --type account --account-name @name@example.social
|
enbas follow --type account --account-name @name@example.social
|
||||||
|
@ -176,7 +179,7 @@ enbas follow --type account --account-name @name@example.social
|
||||||
|
|
||||||
### Unfollow an account
|
### Unfollow an account
|
||||||
|
|
||||||
Unfollow the account that you are currently following.
|
Unfollows the account that you are currently following.
|
||||||
If you have a follow request pending for the account in question,
|
If you have a follow request pending for the account in question,
|
||||||
performing an unfollow action will remove said follow request.
|
performing an unfollow action will remove said follow request.
|
||||||
|
|
||||||
|
@ -191,11 +194,39 @@ enbas unfollow --type account --account-name @name@example.social
|
||||||
|
|
||||||
### Show an account's followers
|
### Show an account's followers
|
||||||
|
|
||||||
_TODO: provide instructions after updated implementation_
|
- 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. | |
|
||||||
|
|
||||||
### Show account's followings
|
### Show account's followings
|
||||||
|
|
||||||
_TODO: provide instructions after updated implementation_
|
- 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. | |
|
||||||
|
|
||||||
### Block an account
|
### Block an account
|
||||||
|
|
||||||
|
@ -313,6 +344,8 @@ enbas show --type follow-request
|
||||||
|
|
||||||
### Accept a 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
|
enbas accept --type follow-request --account-name @person.example.social
|
||||||
```
|
```
|
||||||
|
@ -324,6 +357,8 @@ enbas accept --type follow-request --account-name @person.example.social
|
||||||
|
|
||||||
### Reject a follow request
|
### 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
|
enbas reject --type follow-request --account-name @person.example.social
|
||||||
```
|
```
|
||||||
|
@ -349,19 +384,72 @@ _Not yet supported_
|
||||||
|
|
||||||
### Boost (Repost) a status
|
### Boost (Repost) a status
|
||||||
|
|
||||||
To boost a status you simply add a `boost` to it.
|
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. | |
|
||||||
|
|
||||||
### Un-boost (Un-repost) a status
|
### Un-boost (Un-repost) a status
|
||||||
|
|
||||||
To un-boost a status that you've boosted you simply remove the `boost` from it.
|
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. | |
|
||||||
|
|
||||||
### Like a status
|
### Like a status
|
||||||
|
|
||||||
To like (favourite) a status you simply add a `like` or a `star` to it.
|
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. | |
|
||||||
|
|
||||||
### Unlike a status
|
### Unlike a status
|
||||||
|
|
||||||
To unlike (un-favourite) a status that you've previously liked you simply remove the `like` or `star` from it.
|
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 |
|
||||||
|
|
||||||
### Mute a status
|
### Mute a status
|
||||||
|
|
||||||
|
@ -395,7 +483,7 @@ enbas show --type poll --poll-id 01J0CEEZBZ6E6AYQSJPHCQYBDA
|
||||||
Add your vote(s) to a poll.
|
Add your vote(s) to a poll.
|
||||||
|
|
||||||
```
|
```
|
||||||
enbas add --type vote --to poll --poll-id 01J1TVJ705VV3VP02FVVBSMX7E --choose 3
|
enbas add --type vote --to poll --poll-id 01J1TVJ705VV3VP02FVVBSMX7E --vote 3
|
||||||
```
|
```
|
||||||
|
|
||||||
| flag | type | required | description | default |
|
| flag | type | required | description | default |
|
||||||
|
@ -403,7 +491,7 @@ enbas add --type vote --to poll --poll-id 01J1TVJ705VV3VP02FVVBSMX7E --choose 3
|
||||||
| `type` | string | true | The resource you want to add.<br>Here this should be `vote`. | |
|
| `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`. | |
|
| `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. | |
|
| `poll-id` | string | true | The ID of the poll you want to add the votes to. | |
|
||||||
| `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. | |
|
| `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. | |
|
||||||
|
|
||||||
## Lists
|
## 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.content, flagContent, "", "The content of the resource")
|
||||||
addExe.StringVar(&addExe.pollID, flagPollID, "", "The ID of the poll")
|
addExe.StringVar(&addExe.pollID, flagPollID, "", "The ID of the poll")
|
||||||
addExe.Var(&addExe.accountNames, flagAccountName, "The name of the account")
|
addExe.Var(&addExe.accountNames, flagAccountName, "The name of the account")
|
||||||
addExe.Var(&addExe.choices, flagChoose, "Specify your choice ")
|
addExe.Var(&addExe.choices, flagVote, "Add a vote to an option in a poll")
|
||||||
|
|
||||||
addExe.Usage = commandUsageFunc(name, summary, addExe.FlagSet)
|
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 {
|
func (a *AddExecutor) addVoteToPoll(gtsClient *client.Client) error {
|
||||||
if len(a.choices) == 0 {
|
if len(a.choices) == 0 {
|
||||||
return errors.New("please use --" + flagChoose + " to make a choice in this poll")
|
return errors.New("please use --" + flagVote + " to make a choice in this poll")
|
||||||
}
|
}
|
||||||
|
|
||||||
poll, err := gtsClient.GetPoll(a.pollID)
|
poll, err := gtsClient.GetPoll(a.pollID)
|
||||||
|
|
|
@ -52,6 +52,19 @@ func (e UnsupportedRemoveOperationError) Error() string {
|
||||||
"' is not supported"
|
"' 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 {
|
type EmptyContentError struct {
|
||||||
ResourceType string
|
ResourceType string
|
||||||
Hint string
|
Hint string
|
||||||
|
|
|
@ -16,7 +16,6 @@ const (
|
||||||
flagAccountName = "account-name"
|
flagAccountName = "account-name"
|
||||||
flagAttachmentID = "attachment-id"
|
flagAttachmentID = "attachment-id"
|
||||||
flagBrowser = "browser"
|
flagBrowser = "browser"
|
||||||
flagChoose = "choose"
|
|
||||||
flagContentType = "content-type"
|
flagContentType = "content-type"
|
||||||
flagContent = "content"
|
flagContent = "content"
|
||||||
flagEnableFederation = "enable-federation"
|
flagEnableFederation = "enable-federation"
|
||||||
|
@ -52,6 +51,7 @@ const (
|
||||||
flagTo = "to"
|
flagTo = "to"
|
||||||
flagType = "type"
|
flagType = "type"
|
||||||
flagVisibility = "visibility"
|
flagVisibility = "visibility"
|
||||||
|
flagVote = "vote"
|
||||||
)
|
)
|
||||||
|
|
||||||
type MultiStringFlagValue []string
|
type MultiStringFlagValue []string
|
||||||
|
|
|
@ -287,6 +287,26 @@ func (s *ShowExecutor) showLists(gtsClient *client.Client) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *ShowExecutor) showFollowers(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)
|
accountID, err := getAccountID(gtsClient, s.myAccount, s.accountName, s.config.CredentialsFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("received an error while getting the account ID: %w", err)
|
return fmt.Errorf("received an error while getting the account ID: %w", err)
|
||||||
|
@ -307,6 +327,26 @@ func (s *ShowExecutor) showFollowers(gtsClient *client.Client) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *ShowExecutor) showFollowing(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)
|
accountID, err := getAccountID(gtsClient, s.myAccount, s.accountName, s.config.CredentialsFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("received an error while getting the account ID: %w", err)
|
return fmt.Errorf("received an error while getting the account ID: %w", err)
|
||||||
|
@ -449,7 +489,10 @@ func (s *ShowExecutor) showMedia(gtsClient *client.Client) error {
|
||||||
|
|
||||||
doFunc, ok := funcMap[s.fromResourceType]
|
doFunc, ok := funcMap[s.fromResourceType]
|
||||||
if !ok {
|
if !ok {
|
||||||
return fmt.Errorf("do not support viewing media from %s", s.fromResourceType)
|
return UnsupportedShowOperationError{
|
||||||
|
ResourceType: s.resourceType,
|
||||||
|
ShowFromResourceType: s.fromResourceType,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return doFunc(gtsClient)
|
return doFunc(gtsClient)
|
||||||
|
|
Loading…
Reference in a new issue