From 0ce8614729d0936c7830ed063dbb4e5ed9382d44 Mon Sep 17 00:00:00 2001 From: Dan Anglin Date: Sun, 9 Jun 2024 14:07:26 +0100 Subject: [PATCH] update flag documentation --- cmd/enbas/main.go | 36 ++++++++++++++++++------------------ internal/executor/add.go | 12 ++++++------ internal/executor/block.go | 4 ++-- internal/executor/create.go | 28 ++++++++++++++-------------- internal/executor/delete.go | 4 ++-- internal/executor/edit.go | 8 ++++---- internal/executor/follow.go | 8 ++++---- internal/executor/login.go | 2 +- internal/executor/remove.go | 10 +++++----- internal/executor/show.go | 22 +++++++++++----------- internal/executor/switch.go | 4 ++-- internal/executor/version.go | 2 +- 12 files changed, 70 insertions(+), 70 deletions(-) diff --git a/cmd/enbas/main.go b/cmd/enbas/main.go index 6f70d71..814abfa 100644 --- a/cmd/enbas/main.go +++ b/cmd/enbas/main.go @@ -46,30 +46,30 @@ func main() { func run() error { commandSummaries := map[string]string{ - commandLogin: "login to an account on GoToSocial", - commandVersion: "print the application's version and build information", - commandShow: "print details about a specified resource", - commandSwitch: "perform a switch operation (e.g. switch logged in accounts)", - commandCreate: "create a specific resource", - commandDelete: "delete a specific resource", - commandEdit: "edit a specific resource", - commandWhoami: "print the account that you are currently logged in to", - commandAdd: "add a resource to another resource", - commandRemove: "remove a resource from another resource", - commandFollow: "follow a resource (e.g. an account)", - commandUnfollow: "unfollow a resource (e.g. an account)", - commandBlock: "block a resource (e.g. an account)", - commandUnblock: "unblock a resource (e.g. an account)", + commandLogin: "Login to an account on GoToSocial", + commandVersion: "Print the application's version and build information", + commandShow: "Print details about a specified resource", + commandSwitch: "Perform a switch operation (e.g. switch logged in accounts)", + commandCreate: "Create a specific resource", + commandDelete: "Delete a specific resource", + commandEdit: "Edit a specific resource", + commandWhoami: "Print the account that you are currently logged in to", + commandAdd: "Add a resource to another resource", + commandRemove: "Remove a resource from another resource", + commandFollow: "Follow a resource (e.g. an account)", + commandUnfollow: "Unfollow a resource (e.g. an account)", + commandBlock: "Block a resource (e.g. an account)", + commandUnblock: "Unblock a resource (e.g. an account)", } topLevelFlags := executor.TopLevelFlags{ ConfigDir: "", NoColor: nil, - Pager: "", + Pager: "", } - flag.StringVar(&topLevelFlags.ConfigDir, "config-dir", "", "specify your config directory") - flag.BoolFunc("no-color", "disable ANSI colour output when displaying text on screen", func(value string) error { + flag.StringVar(&topLevelFlags.ConfigDir, "config-dir", "", "Specify your config directory") + flag.BoolFunc("no-color", "Disable ANSI colour output when displaying text on screen", func(value string) error { boolVal, err := strconv.ParseBool(value) if err != nil { return fmt.Errorf("unable to parse %q as a boolean: %w", value, err) @@ -80,7 +80,7 @@ func run() error { return nil }) - flag.StringVar(&topLevelFlags.Pager, "pager", "", "specify your preferred pager if you would like pager support") + flag.StringVar(&topLevelFlags.Pager, "pager", "", "Specify your preferred pager to page through long outputs. This is disabled by default.") flag.Usage = usageFunc(commandSummaries) diff --git a/internal/executor/add.go b/internal/executor/add.go index d48e909..99946d7 100644 --- a/internal/executor/add.go +++ b/internal/executor/add.go @@ -32,12 +32,12 @@ func NewAddExecutor(tlf TopLevelFlags, name, summary string) *AddExecutor { topLevelFlags: tlf, } - addExe.StringVar(&addExe.resourceType, flagType, "", "specify the resource type to add (e.g. account, note)") - addExe.StringVar(&addExe.toResourceType, flagTo, "", "specify the target resource type to add to (e.g. list, account, etc)") - addExe.StringVar(&addExe.listID, flagListID, "", "the ID of the list to add to") - addExe.StringVar(&addExe.statusID, flagStatusID, "", "the ID of the status") - addExe.Var(&addExe.accountNames, flagAccountName, "the name of the account") - addExe.StringVar(&addExe.content, flagContent, "", "the content of the note") + addExe.StringVar(&addExe.resourceType, flagType, "", "Specify the resource type to add (e.g. account, note)") + addExe.StringVar(&addExe.toResourceType, flagTo, "", "Specify the target resource type to add to (e.g. list, account, etc)") + addExe.StringVar(&addExe.listID, flagListID, "", "The ID of the list to add to") + addExe.StringVar(&addExe.statusID, flagStatusID, "", "The ID of the status") + addExe.Var(&addExe.accountNames, flagAccountName, "The name of the account") + addExe.StringVar(&addExe.content, flagContent, "", "The content of the resource") addExe.Usage = commandUsageFunc(name, summary, addExe.FlagSet) diff --git a/internal/executor/block.go b/internal/executor/block.go index 89928c5..9ec2ade 100644 --- a/internal/executor/block.go +++ b/internal/executor/block.go @@ -28,8 +28,8 @@ func NewBlockExecutor(tlf TopLevelFlags, name, summary string, unblock bool) *Bl unblock: unblock, } - blockExe.StringVar(&blockExe.resourceType, flagType, "", "specify the type of resource to block or unblock") - blockExe.StringVar(&blockExe.accountName, flagAccountName, "", "specify the account name in full (username@domain)") + blockExe.StringVar(&blockExe.resourceType, flagType, "", "Specify the type of resource to block or unblock") + blockExe.StringVar(&blockExe.accountName, flagAccountName, "", "Specify the account name in full (username@domain)") blockExe.Usage = commandUsageFunc(name, summary, blockExe.FlagSet) diff --git a/internal/executor/create.go b/internal/executor/create.go index d4c1308..d05814c 100644 --- a/internal/executor/create.go +++ b/internal/executor/create.go @@ -41,21 +41,21 @@ func NewCreateExecutor(tlf TopLevelFlags, name, summary string) *CreateExecutor topLevelFlags: tlf, } - 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.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.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.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.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.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.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.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.BoolFunc(flagSensitive, "specify if the status should be marked as sensitive", func(value string) error { + createExe.BoolFunc(flagSensitive, "Specify if the status should be marked as sensitive", func(value string) error { boolVal, err := strconv.ParseBool(value) if err != nil { return fmt.Errorf("unable to parse %q as a boolean value: %w", value, err) diff --git a/internal/executor/delete.go b/internal/executor/delete.go index 2df8cdb..fec798d 100644 --- a/internal/executor/delete.go +++ b/internal/executor/delete.go @@ -25,8 +25,8 @@ func NewDeleteExecutor(tlf TopLevelFlags, name, summary string) *DeleteExecutor topLevelFlags: tlf, } - deleteExe.StringVar(&deleteExe.resourceType, flagType, "", "specify the type of resource to delete") - deleteExe.StringVar(&deleteExe.listID, flagListID, "", "specify the ID of the list to delete") + deleteExe.StringVar(&deleteExe.resourceType, flagType, "", "Specify the type of resource to delete") + deleteExe.StringVar(&deleteExe.listID, flagListID, "", "Specify the ID of the list to delete") deleteExe.Usage = commandUsageFunc(name, summary, deleteExe.FlagSet) diff --git a/internal/executor/edit.go b/internal/executor/edit.go index aae961a..620a3ca 100644 --- a/internal/executor/edit.go +++ b/internal/executor/edit.go @@ -29,10 +29,10 @@ func NewEditExecutor(tlf TopLevelFlags, name, summary string) *EditExecutor { topLevelFlags: tlf, } - editExe.StringVar(&editExe.resourceType, flagType, "", "specify the type of resource to update") - editExe.StringVar(&editExe.listID, flagListID, "", "specify the ID of the list to update") - editExe.StringVar(&editExe.listTitle, flagListTitle, "", "specify the title of the list") - editExe.StringVar(&editExe.listRepliesPolicy, flagListRepliesPolicy, "", "specify the policy of the replies for this list (valid values are followed, list and none)") + editExe.StringVar(&editExe.resourceType, flagType, "", "Specify the type of resource to update") + editExe.StringVar(&editExe.listID, flagListID, "", "Specify the ID of the list to update") + editExe.StringVar(&editExe.listTitle, flagListTitle, "", "Specify the title of the list") + editExe.StringVar(&editExe.listRepliesPolicy, flagListRepliesPolicy, "", "Specify the policy of the replies for this list (valid values are followed, list and none)") editExe.Usage = commandUsageFunc(name, summary, editExe.FlagSet) diff --git a/internal/executor/follow.go b/internal/executor/follow.go index ea421dc..cce9e42 100644 --- a/internal/executor/follow.go +++ b/internal/executor/follow.go @@ -29,10 +29,10 @@ func NewFollowExecutor(tlf TopLevelFlags, name, summary string, unfollow bool) * topLevelFlags: tlf, } - command.StringVar(&command.resourceType, flagType, "", "specify the type of resource to follow") - command.StringVar(&command.accountName, flagAccountName, "", "specify the account name in full (username@domain)") - command.BoolVar(&command.showReposts, flagShowReposts, true, "show reposts from the account you want to follow") - command.BoolVar(&command.notify, flagNotify, false, "get notifications when the account you want to follow posts a status") + command.StringVar(&command.resourceType, flagType, "", "Specify the type of resource to follow") + command.StringVar(&command.accountName, flagAccountName, "", "Specify the account name in full (username@domain)") + command.BoolVar(&command.showReposts, flagShowReposts, true, "Show reposts from the account you want to follow") + command.BoolVar(&command.notify, flagNotify, false, "Get notifications when the account you want to follow posts a status") command.Usage = commandUsageFunc(name, summary, command.FlagSet) diff --git a/internal/executor/login.go b/internal/executor/login.go index 821a49c..79af662 100644 --- a/internal/executor/login.go +++ b/internal/executor/login.go @@ -28,7 +28,7 @@ func NewLoginExecutor(tlf TopLevelFlags, name, summary string) *LoginExecutor { instance: "", } - command.StringVar(&command.instance, flagInstance, "", "specify the instance that you want to login to.") + command.StringVar(&command.instance, flagInstance, "", "Specify the instance that you want to login to.") command.Usage = commandUsageFunc(name, summary, command.FlagSet) diff --git a/internal/executor/remove.go b/internal/executor/remove.go index 0018ad0..53cdf40 100644 --- a/internal/executor/remove.go +++ b/internal/executor/remove.go @@ -31,11 +31,11 @@ func NewRemoveExecutor(tlf TopLevelFlags, name, summary string) *RemoveExecutor topLevelFlags: tlf, } - removeExe.StringVar(&removeExe.resourceType, flagType, "", "specify the resource type to remove (e.g. account, note)") - removeExe.StringVar(&removeExe.fromResourceType, flagFrom, "", "specify the resource type to remove from (e.g. list, account, etc)") - removeExe.StringVar(&removeExe.listID, flagListID, "", "the ID of the list to remove from") - removeExe.StringVar(&removeExe.statusID, flagStatusID, "", "the ID of the status") - removeExe.Var(&removeExe.accountNames, flagAccountName, "the name of the account to remove from the resource") + removeExe.StringVar(&removeExe.resourceType, flagType, "", "Specify the resource type to remove (e.g. account, note)") + removeExe.StringVar(&removeExe.fromResourceType, flagFrom, "", "Specify the resource type to remove from (e.g. list, account, etc)") + removeExe.StringVar(&removeExe.listID, flagListID, "", "The ID of the list to remove from") + removeExe.StringVar(&removeExe.statusID, flagStatusID, "", "The ID of the status") + removeExe.Var(&removeExe.accountNames, flagAccountName, "The name of the account to remove from the resource") removeExe.Usage = commandUsageFunc(name, summary, removeExe.FlagSet) diff --git a/internal/executor/show.go b/internal/executor/show.go index 3a927ff..cbacb47 100644 --- a/internal/executor/show.go +++ b/internal/executor/show.go @@ -35,17 +35,17 @@ func NewShowExecutor(tlf TopLevelFlags, name, summary string) *ShowExecutor { topLevelFlags: tlf, } - showExe.BoolVar(&showExe.myAccount, flagMyAccount, false, "set to true to lookup your account") - showExe.BoolVar(&showExe.skipAccountRelationship, flagSkipRelationship, false, "set to true to skip showing your relationship to the specified account") - showExe.BoolVar(&showExe.showUserPreferences, flagShowPreferences, false, "show your preferences") - showExe.BoolVar(&showExe.showInBrowser, flagBrowser, false, "set to true to view in the browser") - showExe.StringVar(&showExe.resourceType, flagType, "", "specify the type of resource to display") - showExe.StringVar(&showExe.accountName, flagAccountName, "", "specify the account name in full (username@domain)") - showExe.StringVar(&showExe.statusID, flagStatusID, "", "specify the ID of the status to display") - showExe.StringVar(&showExe.timelineCategory, flagTimelineCategory, model.TimelineCategoryHome, "specify the timeline category to view") - showExe.StringVar(&showExe.listID, flagListID, "", "specify the ID of the list to display") - showExe.StringVar(&showExe.tag, flagTag, "", "specify the name of the tag to use") - showExe.IntVar(&showExe.limit, flagLimit, 20, "specify the limit of items to display") + showExe.BoolVar(&showExe.myAccount, flagMyAccount, false, "Set to true to lookup your account") + showExe.BoolVar(&showExe.skipAccountRelationship, flagSkipRelationship, false, "Set to true to skip showing your relationship to the specified account") + showExe.BoolVar(&showExe.showUserPreferences, flagShowPreferences, false, "Show your preferences") + showExe.BoolVar(&showExe.showInBrowser, flagBrowser, false, "Set to true to view in the browser") + showExe.StringVar(&showExe.resourceType, flagType, "", "Specify the type of resource to display") + showExe.StringVar(&showExe.accountName, flagAccountName, "", "Specify the account name in full (username@domain)") + showExe.StringVar(&showExe.statusID, flagStatusID, "", "Specify the ID of the status to display") + showExe.StringVar(&showExe.timelineCategory, flagTimelineCategory, model.TimelineCategoryHome, "Specify the timeline category to view") + showExe.StringVar(&showExe.listID, flagListID, "", "Specify the ID of the list to display") + showExe.StringVar(&showExe.tag, flagTag, "", "Specify the name of the tag to use") + showExe.IntVar(&showExe.limit, flagLimit, 20, "Specify the limit of items to display") showExe.Usage = commandUsageFunc(name, summary, showExe.FlagSet) diff --git a/internal/executor/switch.go b/internal/executor/switch.go index 5c85ac6..142be3f 100644 --- a/internal/executor/switch.go +++ b/internal/executor/switch.go @@ -25,8 +25,8 @@ func NewSwitchExecutor(tlf TopLevelFlags, name, summary string) *SwitchExecutor topLevelFlags: tlf, } - switchExe.StringVar(&switchExe.toResourceType, flagTo, "", "the account to switch to") - switchExe.StringVar(&switchExe.accountName, flagAccountName, "", "the name of the account to switch to") + switchExe.StringVar(&switchExe.toResourceType, flagTo, "", "The account to switch to") + switchExe.StringVar(&switchExe.accountName, flagAccountName, "", "The name of the account to switch to") switchExe.Usage = commandUsageFunc(name, summary, switchExe.FlagSet) diff --git a/internal/executor/version.go b/internal/executor/version.go index 7ae1892..3689e89 100644 --- a/internal/executor/version.go +++ b/internal/executor/version.go @@ -30,7 +30,7 @@ func NewVersionExecutor(name, summary, binaryVersion, buildTime, goVersion, gitC showFullVersion: false, } - command.BoolVar(&command.showFullVersion, "full", false, "prints the full build information") + command.BoolVar(&command.showFullVersion, "Full", false, "prints the full build information") command.Usage = commandUsageFunc(name, summary, command.FlagSet)