fix: show account relationship by default

This is a breaking change.

Changes:

- Show the relationship between the user and the account by default.
- Remove the show-relationship flag.
- Add the skip-relationship flag so that users can set this to true if
  they don't want to display the relationship.
This commit is contained in:
Dan Anglin 2024-05-23 18:22:13 +01:00
parent 55b93c6586
commit c8ee788832
Signed by: dananglin
GPG key ID: 0C1D44CFBEE68638
2 changed files with 4 additions and 4 deletions

View file

@ -12,7 +12,7 @@ const (
flagNotify = "notify" flagNotify = "notify"
flagFrom = "from" flagFrom = "from"
flagType = "type" flagType = "type"
flagShowRelationship = "show-relationship" flagSkipRelationship = "skip-relationship"
flagShowPreferences = "show-preferences" flagShowPreferences = "show-preferences"
flagShowReposts = "show-reposts" flagShowReposts = "show-reposts"
flagStatusID = "status-id" flagStatusID = "status-id"

View file

@ -13,7 +13,7 @@ type ShowExecutor struct {
*flag.FlagSet *flag.FlagSet
topLevelFlags TopLevelFlags topLevelFlags TopLevelFlags
myAccount bool myAccount bool
showAccountRelationship bool skipAccountRelationship bool
showUserPreferences bool showUserPreferences bool
resourceType string resourceType string
accountName string accountName string
@ -31,7 +31,7 @@ func NewShowExecutor(tlf TopLevelFlags, name, summary string) *ShowExecutor {
} }
command.BoolVar(&command.myAccount, flagMyAccount, false, "set to true to lookup your account") command.BoolVar(&command.myAccount, flagMyAccount, false, "set to true to lookup your account")
command.BoolVar(&command.showAccountRelationship, flagShowRelationship, false, "show your relationship to the specified account") command.BoolVar(&command.skipAccountRelationship, flagSkipRelationship, false, "set to true to skip showing your relationship to the specified account")
command.BoolVar(&command.showUserPreferences, flagShowPreferences, false, "show your preferences") command.BoolVar(&command.showUserPreferences, flagShowPreferences, false, "show your preferences")
command.StringVar(&command.resourceType, flagType, "", "specify the type of resource to display") command.StringVar(&command.resourceType, flagType, "", "specify the type of resource to display")
command.StringVar(&command.accountName, flagAccountName, "", "specify the account name in full (username@domain)") command.StringVar(&command.accountName, flagAccountName, "", "specify the account name in full (username@domain)")
@ -110,7 +110,7 @@ func (c *ShowExecutor) showAccount(gtsClient *client.Client) error {
fmt.Println(account) fmt.Println(account)
if !c.myAccount && c.showAccountRelationship { if !c.myAccount && !c.skipAccountRelationship {
relationship, err := gtsClient.GetAccountRelationship(account.ID) relationship, err := gtsClient.GetAccountRelationship(account.ID)
if err != nil { if err != nil {
return fmt.Errorf("unable to retrieve the relationship to this account; %w", err) return fmt.Errorf("unable to retrieve the relationship to this account; %w", err)