diff --git a/cmd/ipfs2/init.go b/cmd/ipfs2/init.go index d1938db87..009412613 100644 --- a/cmd/ipfs2/init.go +++ b/cmd/ipfs2/init.go @@ -20,14 +20,10 @@ var initCmd = &cmds.Command{ `, Options: []cmds.Option{ - cmds.Option{[]string{"bits", "b"}, cmds.Int, - "Number of bits to use in the generated RSA private key (defaults to 4096)"}, - cmds.Option{[]string{"passphrase", "p"}, cmds.String, - "Passphrase for encrypting the private key"}, - cmds.Option{[]string{"force", "f"}, cmds.Bool, - "Overwrite existing config (if it exists)"}, - cmds.Option{[]string{"datastore", "d"}, cmds.String, - "Location for the IPFS data store"}, + cmds.IntOption("bits", "b", "Number of bits to use in the generated RSA private key (defaults to 4096)"), + cmds.StringOption("passphrase", "p", "Passphrase for encrypting the private key"), + cmds.BoolOption("force", "f", "Overwrite existing config (if it exists)"), + cmds.StringOption("datastore", "d", "Location for the IPFS data store"), }, Run: func(req cmds.Request) (interface{}, error) { diff --git a/core/commands2/add.go b/core/commands2/add.go index 274ec524b..043ac32cb 100644 --- a/core/commands2/add.go +++ b/core/commands2/add.go @@ -23,7 +23,7 @@ type AddOutput struct { var addCmd = &cmds.Command{ Options: []cmds.Option{ - cmds.Option{[]string{"recursive", "r"}, cmds.Bool, "Must be specified when adding directories"}, + cmds.BoolOption("recursive", "r", "Must be specified when adding directories"), }, Arguments: []cmds.Argument{ cmds.Argument{"file", cmds.ArgFile, true, true, "The path to a file to be added to IPFS"}, diff --git a/core/commands2/mount_unix.go b/core/commands2/mount_unix.go index 14fdcb63d..7bd7128f9 100644 --- a/core/commands2/mount_unix.go +++ b/core/commands2/mount_unix.go @@ -24,16 +24,11 @@ not be listable, as it is virtual. Accessing known paths directly. `, Options: []cmds.Option{ - - // TODO text: specify a mountpoint for ipfs // TODO longform - cmds.Option{[]string{"f"}, cmds.String, - "The path where IPFS should be mounted\n(default is '/ipfs')"}, + cmds.StringOption("f", "The path where IPFS should be mounted\n(default is '/ipfs')"), - // TODO text: specify a mountpoint for ipns // TODO longform - cmds.Option{[]string{"n"}, cmds.String, - "The path where IPNS should be mounted\n(default is '/ipns')"}, + cmds.StringOption("n", "The path where IPNS should be mounted\n(default is '/ipns')"), }, Run: func(req cmds.Request) (interface{}, error) { ctx := req.Context() diff --git a/core/commands2/pin.go b/core/commands2/pin.go index fac0aa859..77d382c9a 100644 --- a/core/commands2/pin.go +++ b/core/commands2/pin.go @@ -29,8 +29,7 @@ on disk. "Path to object(s) to be pinned"}, }, Options: []cmds.Option{ - cmds.Option{[]string{"recursive", "r"}, cmds.Bool, - "Recursively pin the object linked to by the specified object(s)"}, + cmds.BoolOption("recursive", "r", "Recursively pin the object linked to by the specified object(s)"), }, Run: func(req cmds.Request) (interface{}, error) { n := req.Context().Node @@ -65,8 +64,7 @@ collected if needed. "Path to object(s) to be unpinned"}, }, Options: []cmds.Option{ - cmds.Option{[]string{"recursive", "r"}, cmds.Bool, - "Recursively unpin the object linked to by the specified object(s)"}, + cmds.BoolOption("recursive", "r", "Recursively unpin the object linked to by the specified object(s)"), }, Run: func(req cmds.Request) (interface{}, error) { n := req.Context().Node diff --git a/core/commands2/refs.go b/core/commands2/refs.go index 41354d688..f4eb4d2e2 100644 --- a/core/commands2/refs.go +++ b/core/commands2/refs.go @@ -29,10 +29,8 @@ Note: list all refs recursively with -r.`, "Path to the object(s) to list refs from"}, }, Options: []cmds.Option{ - cmds.Option{[]string{"unique", "u"}, cmds.Bool, - "Omit duplicate refs from output"}, - cmds.Option{[]string{"recursive", "r"}, cmds.Bool, - "Recursively list links of child nodes"}, + cmds.BoolOption("unique", "u", "Omit duplicate refs from output"), + cmds.BoolOption("recursive", "r", "Recursively list links of child nodes"), }, Run: func(req cmds.Request) (interface{}, error) { n := req.Context().Node diff --git a/core/commands2/root.go b/core/commands2/root.go index 29fb82a57..187592ceb 100644 --- a/core/commands2/root.go +++ b/core/commands2/root.go @@ -44,14 +44,10 @@ Use "ipfs --help" for more information about a command. `, Options: []cmds.Option{ - cmds.Option{[]string{"config", "c"}, cmds.String, - "Path to the configuration file to use"}, - cmds.Option{[]string{"debug", "D"}, cmds.Bool, - "Operate in debug mode"}, - cmds.Option{[]string{"help", "h"}, cmds.Bool, - "Show the command help text"}, - cmds.Option{[]string{"local", "L"}, cmds.Bool, - "Run the command locally, instead of using the daemon"}, + cmds.StringOption("config", "c", "Path to the configuration file to use"), + cmds.BoolOption("debug", "D", "Operate in debug mode"), + cmds.BoolOption("help", "h", "Show the command help text"), + cmds.BoolOption("local", "L", "Run the command locally, instead of using the daemon"), }, } diff --git a/core/commands2/version.go b/core/commands2/version.go index 3777ae075..ca80f538f 100644 --- a/core/commands2/version.go +++ b/core/commands2/version.go @@ -17,8 +17,7 @@ var versionCmd = &cmds.Command{ `, Options: []cmds.Option{ - cmds.Option{[]string{"number", "n"}, cmds.Bool, - "Only output the version number"}, + cmds.BoolOption("number", "n", "Only output the version number"), }, Run: func(req cmds.Request) (interface{}, error) { return &VersionOutput{