Documentation

Cli.Basic

def Cli.List.matchLength {α : Type u_1} (a : List α) (b : List α) (unit : α) :
List α × List α

Matches the lengths of lists a and b by filling the shorter one with unit elements at the tail end. The matched lists are returned in the same order as they were passed.

Equations
Instances For
    def Cli.Array.join {α : Type u_1} (xss : Array (Array α)) :
    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      def Cli.Array.flatMap {α : Type u_1} {β : Type u_2} (f : αArray β) (xs : Array α) :
      Equations
      Instances For
        def Cli.String.wrapAt? (s : String) (maxWidth : Nat) :

        Inserts newlines \n into s after every maxWidth characters so that the result contains no line longer than maxWidth characters. Retains newlines \n in s. Yields none if maxWidth = 0.

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For
          def Cli.String.wrapAt! (s : String) (maxWidth : Nat) :

          Inserts newlines \n into s after every maxWidth characters so that the result contains no line longer than maxWidth characters. Retains newlines \n in s. Panics if maxWidth = 0.

          Equations
          Instances For

            Deletes all trailing spaces at the end of every line, as seperated by \n.

            Equations
            Instances For

              Inserts newlines \n into s after every maxWidth characters before words that would otherwise be broken apart by the newline. The result will contain no line longer than maxWidth characters and no words except those already longer than maxWidth characters will be broken up in the middle. Removes trailing whitespace before each inserted newline. Retains newlines \n in s. Returns none if maxWidth = 0.

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For
                def Cli.String.wrapWordsAt! (s : String) (maxWidth : Nat) :

                Inserts newlines \n into s after every maxWidth characters before words that would otherwise be broken apart by the newline. The result will contain no line longer than maxWidth characters and no words except those already longer than maxWidth characters will be broken up in the middle. Removes trailing whitespace before each inserted newline. Retains newlines \n in s. Panics if maxWidth = 0.

                Equations
                Instances For

                  Inserts n spaces before each line as seperated by \n in s. Does not indent s = "".

                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For

                    Intercalates elements ≠ "" in xs using sep.

                    Equations
                    Instances For
                      def Cli.Array.renderTable? (rows : Array (String × String)) (maxWidth : Nat) (margin : optParam Nat 2) :

                      Renders rows as a table with a maximum row width of maxWidth and a margin of margin between the columns. Wraps words according to String.wrapWordsAt? to ensure that no rendered row of the table is longer than maxWidth. Returns none if (maxWidth-margin)/2 < 1, i.e. if there is not enough space for text in both columns.

                      Equations
                      • One or more equations did not get rendered due to their size.
                      Instances For
                        def Cli.Array.renderTable! (rows : Array (String × String)) (maxWidth : Nat) (margin : optParam Nat 2) :

                        Renders rows as a table with a maximum row width of maxWidth and a margin of margin between the columns. Wraps words according to String.wrapWordsAt? to ensure that no rendered row of the table is longer than maxWidth. Panics if (maxWidth-margin)/2 < 1, i.e. if there is not enough space for text in both columns.

                        Equations
                        Instances For
                          def Cli.Option.join {α : Type u_1} (x : Option (Option α)) :
                          Equations
                          Instances For
                            def Cli.Option.optStr {α : Type u_1} [ToString α] :
                            Option αString

                            Returns "" if the passed Option is none, otherwise converts the contained value using a ToString instance.

                            Equations
                            Instances For
                              class Cli.ParseableType (τ : Type u_1) :
                              Type u_1

                              Represents a type that can be parsed to a string and the corresponding name of the type. Used for converting parsed user input to the respective expected type.

                              • name : String

                                Name of the type, used when displaying the help.

                              • parse? : StringOption τ

                                Function to parse a value to the type that returns none if it cannot be parsed.

                              Instances
                                Equations
                                Equations
                                Equations
                                Equations
                                Equations

                                A type synonym for Name, which will carry a ParseableType ModuleName instance, supporting parsing either a module name (e.g. Mathlib.Topology.Basic) or a relative path to a Lean file (e.g. Mathlib/Topology/Basic.lean).

                                Equations
                                Instances For

                                  Check that a ModuleName has no .num or empty components, and is not .anonymous.

                                  Equations
                                  Instances For

                                    A custom command-line argument parser that allows either relative paths to Lean files, (e.g. Mathlib/Topology/Basic.lean) or the module name (e.g. Mathlib.Topology.Basic).

                                    Equations
                                    • One or more equations did not get rendered due to their size.
                                    Equations
                                    • One or more equations did not get rendered due to their size.
                                    structure Cli.ParamType :

                                    Represents the type of some flag or argument parameter. Typically coerced from types with ParseableType instances such that isValid := (ParseableType.parse? · |>.isSome).

                                    • name : String

                                      Name of the type, used when displaying the help.

                                    • isValid : StringBool

                                      Function to check whether a value conforms to the type.

                                    Instances For
                                      Equations
                                      Equations
                                      Equations
                                      Equations
                                      structure Cli.Flag :

                                      Represents a flag, usually known as "option" in standard terminology.

                                      • shortName? : Option String

                                        Designates x in -x.

                                      • longName : String

                                        Designates x in --x.

                                      • description : String

                                        Description that is displayed in the help.

                                      • Type according to which the parameter is validated. Unit is used to designate flags without a parameter.

                                      Instances For
                                        Equations
                                        • Cli.instInhabitedFlag = { default := { shortName? := default, longName := default, description := default, type := default } }
                                        def Cli.Flag.paramless (shortName? : optParam (Option String) none) (longName : String) (description : String) :

                                        Initializes a flag without a parameter. Parameterless flags are designated by the Unit type.

                                        Equations
                                        • One or more equations did not get rendered due to their size.
                                        Instances For

                                          Designates x in -x.

                                          Equations
                                          • f.shortName! = f.shortName?.get!
                                          Instances For

                                            Checks whether f has an associated short flag name x in -x.

                                            Equations
                                            • f.hasShortName = f.shortName?.isSome
                                            Instances For

                                              Checks whether f has a Unit type.

                                              Equations
                                              Instances For
                                                structure Cli.Arg :

                                                Represents an argument (either positional or variable), usually known as "operand" in standard terminology

                                                Instances For
                                                  Equations

                                                  Represents a flag and its parsed value. Use Parsed.Flag.as! to convert the value to some ParseableType.

                                                  • flag : Cli.Flag

                                                    Associated flag meta-data.

                                                  • value : String

                                                    Parsed value that was validated and conforms to flag.type.

                                                  Instances For
                                                    Equations
                                                    Equations
                                                    • One or more equations did not get rendered due to their size.

                                                    Converts f.value to τ, which should be the same type that was designated in f.flag.type. Yields none if the conversion was unsuccessful, which can only happen if τ is not the same type as the one designated in f.flag.type.

                                                    Equations
                                                    Instances For

                                                      Converts f.value to τ, which should be the same type that was designated in f.flag.type. Panics if the conversion was unsuccessful, which can only happen if τ is not the same type as the one designated in f.flag.type.

                                                      Equations
                                                      • f.as! τ = (f.as? τ).get!
                                                      Instances For
                                                        structure Cli.Parsed.Arg :

                                                        Represents an argument and its parsed value. Use Parsed.Arg.as! to convert the value to some ParseableType.

                                                        • arg : Cli.Arg

                                                          Associated argument meta-data.

                                                        • value : String

                                                          Parsed value that was validated and conforms to arg.type.

                                                        Instances For
                                                          Equations

                                                          Converts a.value to τ, which should be the same type that was designated in a.arg.type. Yields none if the conversion was unsuccessful, which can only happen if τ is not the same type as the one designated in a.arg.type.

                                                          Equations
                                                          Instances For

                                                            Converts a.value to τ, which should be the same type that was designated in a.arg.type. Panics if the conversion was unsuccessful, which can only happen if τ is not the same type as the one designated in a.arg.type.

                                                            Equations
                                                            • a.as! τ = (a.as? τ).get!
                                                            Instances For
                                                              structure Cli.Cmd.Meta :

                                                              Represents all the non-recursive meta-data of a command.

                                                              • name : String

                                                                Name that is displayed in the help.

                                                              • parentNames : Array String

                                                                Names of the commands of which this command is a subcommand. Corresponds to the path from the root to this command.

                                                              • version? : Option String

                                                                Version of the command that is displayed in the help and when the version is queried.

                                                              • description : String

                                                                Description that is displayed in the help.

                                                              • furtherInformation? : Option String

                                                                Information appended to the end of the help. Useful for command extensions.

                                                              • flags : Array Cli.Flag

                                                                Supported flags ("options" in standard terminology).

                                                              • positionalArgs : Array Cli.Arg

                                                                Supported positional arguments ("operands" in standard terminology).

                                                              • variableArg? : Option Cli.Arg

                                                                Variable argument after the end of the positional arguments.

                                                              Instances For
                                                                Equations
                                                                • One or more equations did not get rendered due to their size.

                                                                Full name from the root to this command, including the name of the command itself.

                                                                Equations
                                                                • m.fullName = " ".intercalate (m.parentNames.push m.name).toList
                                                                Instances For

                                                                  Version of the command that is displayed in the help and when the version is queried.

                                                                  Equations
                                                                  • m.version! = m.version?.get!
                                                                  Instances For

                                                                    Information appended to the end of the help. Useful for command extensions.

                                                                    Equations
                                                                    • m.furtherInformation! = m.furtherInformation?.get!
                                                                    Instances For

                                                                      Variable argument after the end of the positional arguments.

                                                                      Equations
                                                                      • m.variableArg! = m.variableArg?.get!
                                                                      Instances For

                                                                        Checks whether m has a version.

                                                                        Equations
                                                                        • m.hasVersion = m.version?.isSome
                                                                        Instances For

                                                                          Checks whether m has information appended to the end of the help.

                                                                          Equations
                                                                          • m.hasFurtherInformation = m.furtherInformation?.isSome
                                                                          Instances For

                                                                            Checks whether m supports a variable argument.

                                                                            Equations
                                                                            • m.hasVariableArg = m.variableArg?.isSome
                                                                            Instances For

                                                                              Finds the flag in m with the corresponding longName.

                                                                              Equations
                                                                              • m.flag? longName = m.flags.find? fun (x : Cli.Flag) => decide (x.longName = longName)
                                                                              Instances For

                                                                                Finds the positional argument in m with the corresponding name.

                                                                                Equations
                                                                                • m.positionalArg? name = m.positionalArgs.find? fun (x : Cli.Arg) => decide (x.name = name)
                                                                                Instances For

                                                                                  Finds the flag in m with the corresponding longName.

                                                                                  Equations
                                                                                  • m.flag! longName = (m.flag? longName).get!
                                                                                  Instances For

                                                                                    Finds the positional argument in m with the corresponding name.

                                                                                    Equations
                                                                                    • m.positionalArg! name = (m.positionalArg? name).get!
                                                                                    Instances For

                                                                                      Checks whether m contains a flag with the corresponding longName.

                                                                                      Equations
                                                                                      • m.hasFlag longName = (m.flag? longName).isSome
                                                                                      Instances For

                                                                                        Checks whether m contains a positional argument with the corresponding name.

                                                                                        Equations
                                                                                        • m.hasPositionalArg name = (m.positionalArg? name).isSome
                                                                                        Instances For

                                                                                          Finds the flag in m with the corresponding shortName.

                                                                                          Equations
                                                                                          • m.flagByShortName? name = m.flags.findSome? fun (flag : Cli.Flag) => do let shortNameflag.shortName? guard (shortName = name) pure flag
                                                                                          Instances For

                                                                                            Finds the flag in m with the corresponding shortName.

                                                                                            Equations
                                                                                            • m.flagByShortName! name = (m.flagByShortName? name).get!
                                                                                            Instances For

                                                                                              Checks whether m has a flag with the corresponding shortName.

                                                                                              Equations
                                                                                              • m.hasFlagByShortName name = (m.flagByShortName? name).isSome
                                                                                              Instances For

                                                                                                Adds help (-h, --help) and version (--version) flags to m. Does not add a version flag if m does not designate a version.

                                                                                                Equations
                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                Instances For
                                                                                                  inductive Cli.Parsed.Cmd :

                                                                                                  Represents a recursive variant of Cmd.Meta that is used in Parsed to replicate the recursive subcommand structure of a command without referring to the command itself.

                                                                                                  Instances For

                                                                                                    Meta of this command.

                                                                                                    Equations
                                                                                                    Instances For

                                                                                                      Subcommands.

                                                                                                      Equations
                                                                                                      Instances For

                                                                                                        Finds the subcommand in c with the corresponding name.

                                                                                                        Equations
                                                                                                        Instances For

                                                                                                          Finds the subcommand in c with the corresponding name.

                                                                                                          Equations
                                                                                                          • c.subCmd! name = (c.subCmd? name).get!
                                                                                                          Instances For

                                                                                                            Checks whether c contains a subcommand with the corresponding name.

                                                                                                            Equations
                                                                                                            • c.hasSubCmd name = (c.subCmd? name).isSome
                                                                                                            Instances For
                                                                                                              structure Cli.Parsed :

                                                                                                              Represents parsed user input data.

                                                                                                              Instances For
                                                                                                                Equations
                                                                                                                • Cli.instInhabitedParsed = { default := { cmd := default, parent? := default, flags := default, positionalArgs := default, variableArgs := default } }

                                                                                                                Parent of the associated command.

                                                                                                                Equations
                                                                                                                • p.parent! = p.parent?.get!
                                                                                                                Instances For

                                                                                                                  Checks whether the associated command has a parent, i.e. whether it is not the root command.

                                                                                                                  Equations
                                                                                                                  • p.hasParent = p.parent?.isSome
                                                                                                                  Instances For

                                                                                                                    Finds the parsed flag in p with the corresponding longName.

                                                                                                                    Equations
                                                                                                                    Instances For

                                                                                                                      Finds the parsed positional argument in p with the corresponding name.

                                                                                                                      Equations
                                                                                                                      Instances For

                                                                                                                        Finds the parsed flag in p with the corresponding longName.

                                                                                                                        Equations
                                                                                                                        • p.flag! longName = (p.flag? longName).get!
                                                                                                                        Instances For

                                                                                                                          Finds the parsed positional argument in p with the corresponding name.

                                                                                                                          Equations
                                                                                                                          • p.positionalArg! name = (p.positionalArg? name).get!
                                                                                                                          Instances For
                                                                                                                            def Cli.Parsed.hasFlag (p : Cli.Parsed) (longName : String) :

                                                                                                                            Checks whether p has a parsed flag with the corresponding longName.

                                                                                                                            Equations
                                                                                                                            • p.hasFlag longName = (p.flag? longName).isSome
                                                                                                                            Instances For

                                                                                                                              Checks whether p has a positional argument with the corresponding longName.

                                                                                                                              Equations
                                                                                                                              • p.hasPositionalArg name = (p.positionalArg? name).isSome
                                                                                                                              Instances For

                                                                                                                                Converts all p.variableArgs values to τ, which should be the same type that was designated in the corresponding Cli.Arg. Yields none if the conversion was unsuccessful, which can only happen if τ is not the same type as the one designated in the corresponding Cli.Arg.

                                                                                                                                Equations
                                                                                                                                Instances For

                                                                                                                                  Converts all p.variableArgs values to τ, which should be the same type that was designated in the corresponding Cli.Arg. Panics if the conversion was unsuccessful, which can only happen if τ is not the same type as the one designated in the corresponding Cli.Arg.

                                                                                                                                  Equations
                                                                                                                                  • p.variableArgsAs! τ = (p.variableArgsAs? τ).get!
                                                                                                                                  Instances For
                                                                                                                                    Equations
                                                                                                                                    • One or more equations did not get rendered due to their size.

                                                                                                                                    Represents a view of Cmd that can be passed to Extensions, i.e. it does not itself reference the Extension provided for each Cmd.

                                                                                                                                    Instances For

                                                                                                                                      Non-recursive meta-data.

                                                                                                                                      Equations
                                                                                                                                      Instances For

                                                                                                                                        Handler to run when the command is called and flags/arguments have been successfully processed.

                                                                                                                                        Equations
                                                                                                                                        Instances For

                                                                                                                                          Subcommands. May be mutated by extensions.

                                                                                                                                          Equations
                                                                                                                                          Instances For

                                                                                                                                            Updates the designated fields in c.

                                                                                                                                            • meta: Non-recursive meta-data.
                                                                                                                                            • run: Handler to run when the command is called and flags/arguments have been successfully processed.
                                                                                                                                            • subCmds: Subcommands.
                                                                                                                                            Equations
                                                                                                                                            Instances For
                                                                                                                                              def Cli.ExtendableCmd.update (c : Cli.ExtendableCmd) (name : optParam String c.meta.name) (version? : optParam (Option String) c.meta.version?) (description : optParam String c.meta.description) (furtherInformation? : optParam (Option String) c.meta.furtherInformation?) (flags : optParam (Array Cli.Flag) c.meta.flags) (positionalArgs : optParam (Array Cli.Arg) c.meta.positionalArgs) (variableArg? : optParam (Option Cli.Arg) c.meta.variableArg?) (run : optParam (Cli.ParsedIO UInt32) c.run) (subCmds : optParam (Array Cli.ExtendableCmd) c.subCmds) :

                                                                                                                                              Updates the designated fields in c.

                                                                                                                                              • name: Name that is displayed in the help.
                                                                                                                                              • version?: Version that is displayed in the help and when the version is queried.
                                                                                                                                              • description: Description that is displayed in the help.
                                                                                                                                              • furtherInformation?: Information appended to the end of the help. Useful for command extensions.
                                                                                                                                              • flags: Supported flags ("options" in standard terminology).
                                                                                                                                              • positionalArgs: Supported positional arguments ("operands" in standard terminology).
                                                                                                                                              • variableArg?: Variable argument at the end of the positional arguments.
                                                                                                                                              • run: Handler to run when the command is called and flags/arguments have been successfully processed.
                                                                                                                                              • subCmds: Subcommands.
                                                                                                                                              Equations
                                                                                                                                              • One or more equations did not get rendered due to their size.
                                                                                                                                              Instances For

                                                                                                                                                Creates a new ExtendableCmd. The resulting ExtendableCmd will not have an extension.

                                                                                                                                                • meta: Non-recursive meta-data.
                                                                                                                                                • run: Handler to run when the command is called and flags/arguments have been successfully processed.
                                                                                                                                                • subCmds: Subcommands.
                                                                                                                                                Equations
                                                                                                                                                Instances For

                                                                                                                                                  Creates a new ExtendableCmd. The resulting ExtendableCmd will not have an extension. Adds a -h, --help and a --version flag if meta designates a version.

                                                                                                                                                  • meta: Non-recursive meta-data.
                                                                                                                                                  • run: Handler to run when the command is called and flags/arguments have been successfully processed.
                                                                                                                                                  • subCmds: Subcommands.
                                                                                                                                                  Equations
                                                                                                                                                  Instances For
                                                                                                                                                    def Cli.ExtendableCmd.mk (parent : Cli.ExtendableCmd) (name : String) (version? : Option String) (description : String) (furtherInformation? : optParam (Option String) none) (flags : optParam (Array Cli.Flag) #[]) (positionalArgs : optParam (Array Cli.Arg) #[]) (variableArg? : optParam (Option Cli.Arg) none) (run : Cli.ParsedIO UInt32) (subCmds : optParam (Array Cli.ExtendableCmd) #[]) :

                                                                                                                                                    Creates a new ExtendableCmd. The resulting ExtendableCmd will not have an extension.

                                                                                                                                                    • parent: Parent of this command.
                                                                                                                                                    • name: Name that is displayed in the help.
                                                                                                                                                    • version?: Version that is displayed in the help and when the version is queried.
                                                                                                                                                    • description: Description that is displayed in the help.
                                                                                                                                                    • furtherInformation?: Information appended to the end of the help. Useful for command extensions.
                                                                                                                                                    • flags: Supported flags ("options" in standard terminology).
                                                                                                                                                    • positionalArgs: Supported positional arguments ("operands" in standard terminology).
                                                                                                                                                    • variableArg?: Variable argument at the end of the positional arguments.
                                                                                                                                                    • run: Handler to run when the command is called and flags/arguments have been successfully processed.
                                                                                                                                                    • subCmds: Subcommands.
                                                                                                                                                    Equations
                                                                                                                                                    • One or more equations did not get rendered due to their size.
                                                                                                                                                    Instances For
                                                                                                                                                      def Cli.ExtendableCmd.mkWithHelpAndVersionFlags (parent : Cli.ExtendableCmd) (name : String) (version? : Option String) (description : String) (furtherInformation? : optParam (Option String) none) (flags : optParam (Array Cli.Flag) #[]) (positionalArgs : optParam (Array Cli.Arg) #[]) (variableArg? : optParam (Option Cli.Arg) none) (run : Cli.ParsedIO UInt32) (subCmds : optParam (Array Cli.ExtendableCmd) #[]) :

                                                                                                                                                      Creates a new ExtendableCmd. The resulting ExtendableCmd will not have an extension. Adds a -h, --help and a --version flag if version? is present.

                                                                                                                                                      • parent: Parent of this command.
                                                                                                                                                      • name: Name that is displayed in the help.
                                                                                                                                                      • version?: Version that is displayed in the help and when the version is queried.
                                                                                                                                                      • description: Description that is displayed in the help.
                                                                                                                                                      • furtherInformation?: Information appended to the end of the help. Useful for command extensions.
                                                                                                                                                      • flags: Supported flags ("options" in standard terminology).
                                                                                                                                                      • positionalArgs: Supported positional arguments ("operands" in standard terminology).
                                                                                                                                                      • variableArg?: Variable argument at the end of the positional arguments.
                                                                                                                                                      • run: Handler to run when the command is called and flags/arguments have been successfully processed.
                                                                                                                                                      • subCmds: Subcommands.
                                                                                                                                                      Equations
                                                                                                                                                      • One or more equations did not get rendered due to their size.
                                                                                                                                                      Instances For

                                                                                                                                                        Name that is displayed in the help.

                                                                                                                                                        Equations
                                                                                                                                                        • c.name = c.meta.name
                                                                                                                                                        Instances For

                                                                                                                                                          Version of the command that is displayed in the help and when the version is queried.

                                                                                                                                                          Equations
                                                                                                                                                          • c.version? = c.meta.version?
                                                                                                                                                          Instances For

                                                                                                                                                            Description that is displayed in the help.

                                                                                                                                                            Equations
                                                                                                                                                            • c.description = c.meta.description
                                                                                                                                                            Instances For

                                                                                                                                                              Information appended to the end of the help. Useful for command extensions.

                                                                                                                                                              Equations
                                                                                                                                                              • c.furtherInformation? = c.meta.furtherInformation?
                                                                                                                                                              Instances For

                                                                                                                                                                Supported flags ("options" in standard terminology).

                                                                                                                                                                Equations
                                                                                                                                                                • c.flags = c.meta.flags
                                                                                                                                                                Instances For

                                                                                                                                                                  Supported positional arguments ("operands" in standard terminology).

                                                                                                                                                                  Equations
                                                                                                                                                                  • c.positionalArgs = c.meta.positionalArgs
                                                                                                                                                                  Instances For

                                                                                                                                                                    Variable argument after the end of the positional arguments.

                                                                                                                                                                    Equations
                                                                                                                                                                    • c.variableArg? = c.meta.variableArg?
                                                                                                                                                                    Instances For

                                                                                                                                                                      Full name from the root to this command, including the name of the command itself.

                                                                                                                                                                      Equations
                                                                                                                                                                      • c.fullName = c.meta.fullName
                                                                                                                                                                      Instances For

                                                                                                                                                                        Version of the command that is displayed in the help and when the version is queried.

                                                                                                                                                                        Equations
                                                                                                                                                                        • c.version! = c.meta.version!
                                                                                                                                                                        Instances For

                                                                                                                                                                          Information appended to the end of the help. Useful for command extensions.

                                                                                                                                                                          Equations
                                                                                                                                                                          • c.furtherInformation! = c.meta.furtherInformation!
                                                                                                                                                                          Instances For

                                                                                                                                                                            Variable argument after the end of the positional arguments.

                                                                                                                                                                            Equations
                                                                                                                                                                            • c.variableArg! = c.meta.variableArg!
                                                                                                                                                                            Instances For

                                                                                                                                                                              Checks whether c has a version.

                                                                                                                                                                              Equations
                                                                                                                                                                              • c.hasVersion = c.meta.hasVersion
                                                                                                                                                                              Instances For

                                                                                                                                                                                Checks whether c has information appended to the end of the help.

                                                                                                                                                                                Equations
                                                                                                                                                                                • c.hasFurtherInformation = c.meta.hasFurtherInformation
                                                                                                                                                                                Instances For

                                                                                                                                                                                  Checks whether c supports a variable argument.

                                                                                                                                                                                  Equations
                                                                                                                                                                                  • c.hasVariableArg = c.meta.hasVariableArg
                                                                                                                                                                                  Instances For

                                                                                                                                                                                    Finds the flag in c with the corresponding longName.

                                                                                                                                                                                    Equations
                                                                                                                                                                                    • c.flag? longName = c.meta.flag? longName
                                                                                                                                                                                    Instances For

                                                                                                                                                                                      Finds the positional argument in c with the corresponding name.

                                                                                                                                                                                      Equations
                                                                                                                                                                                      • c.positionalArg? name = c.meta.positionalArg? name
                                                                                                                                                                                      Instances For

                                                                                                                                                                                        Finds the flag in c with the corresponding longName.

                                                                                                                                                                                        Equations
                                                                                                                                                                                        • c.flag! longName = c.meta.flag! longName
                                                                                                                                                                                        Instances For

                                                                                                                                                                                          Finds the positional argument in c with the corresponding name.

                                                                                                                                                                                          Equations
                                                                                                                                                                                          • c.positionalArg! name = c.meta.positionalArg! name
                                                                                                                                                                                          Instances For

                                                                                                                                                                                            Checks whether c contains a flag with the corresponding longName.

                                                                                                                                                                                            Equations
                                                                                                                                                                                            • c.hasFlag longName = c.meta.hasFlag longName
                                                                                                                                                                                            Instances For

                                                                                                                                                                                              Checks whether c contains a positional argument with the corresponding name.

                                                                                                                                                                                              Equations
                                                                                                                                                                                              • c.hasPositionalArg name = c.meta.hasPositionalArg name
                                                                                                                                                                                              Instances For

                                                                                                                                                                                                Finds the flag in c with the corresponding shortName.

                                                                                                                                                                                                Equations
                                                                                                                                                                                                • c.flagByShortName? name = c.meta.flagByShortName? name
                                                                                                                                                                                                Instances For

                                                                                                                                                                                                  Finds the subcommand in c with the corresponding name.

                                                                                                                                                                                                  Equations
                                                                                                                                                                                                  Instances For

                                                                                                                                                                                                    Finds the flag in c with the corresponding shortName.

                                                                                                                                                                                                    Equations
                                                                                                                                                                                                    • c.flagByShortName! name = c.meta.flagByShortName! name
                                                                                                                                                                                                    Instances For

                                                                                                                                                                                                      Finds the subcommand in c with the corresponding name.

                                                                                                                                                                                                      Equations
                                                                                                                                                                                                      • c.subCmd! name = (c.subCmd? name).get!
                                                                                                                                                                                                      Instances For

                                                                                                                                                                                                        Checks whether c has a flag with the corresponding shortName.

                                                                                                                                                                                                        Equations
                                                                                                                                                                                                        • c.hasFlagByShortName name = c.meta.hasFlagByShortName name
                                                                                                                                                                                                        Instances For

                                                                                                                                                                                                          Checks whether c contains a subcommand with the corresponding name.

                                                                                                                                                                                                          Equations
                                                                                                                                                                                                          • c.hasSubCmd name = (c.subCmd? name).isSome
                                                                                                                                                                                                          Instances For
                                                                                                                                                                                                            structure Cli.Extension :

                                                                                                                                                                                                            Allows user code to extend the library in two ways:

                                                                                                                                                                                                            • A command can be replaced or extended with new components.
                                                                                                                                                                                                            • The output of the parser can be postprocessed and validated.
                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                              Equations

                                                                                                                                                                                                              Composes both extensions so that the Cmds are extended in succession and postprocessed in succession. Postprocessing errors if any of the two postprocess functions errors.

                                                                                                                                                                                                              Equations
                                                                                                                                                                                                              • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                              Instances For
                                                                                                                                                                                                                inductive Cli.Cmd :

                                                                                                                                                                                                                Represents a command, i.e. either the application root or some subcommand of the root.

                                                                                                                                                                                                                Instances For
                                                                                                                                                                                                                  Equations

                                                                                                                                                                                                                  Non-recursive meta-data.

                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                  Instances For

                                                                                                                                                                                                                    Handler to run when the command is called and flags/arguments have been successfully processed.

                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                    Instances For

                                                                                                                                                                                                                      Subcommands.

                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                      Instances For

                                                                                                                                                                                                                        Extension of the Cli library.

                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                        Instances For

                                                                                                                                                                                                                          Recomputes all the parent names of subcommands in c with c as the root command.

                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                          Instances For
                                                                                                                                                                                                                            def Cli.Cmd.mk' (meta : Cli.Cmd.Meta) (run : Cli.ParsedIO UInt32) (subCmds : optParam (Array Cli.Cmd) #[]) (extension? : optParam (Option Cli.Extension) none) :

                                                                                                                                                                                                                            Creates a new command. Adds a -h, --help and a --version flag if meta designates a version. Updates the parentNames of all subcommands.

                                                                                                                                                                                                                            • meta: Non-recursive meta-data.
                                                                                                                                                                                                                            • run: Handler to run when the command is called and flags/arguments have been successfully processed.
                                                                                                                                                                                                                            • subCmds: Subcommands.
                                                                                                                                                                                                                            • extension?: Extension of the Cli library.
                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                            • Cli.Cmd.mk' meta run subCmds extension? = (Cli.Cmd.init meta.addHelpAndVersionFlags run subCmds extension?).updateParentNames
                                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                                              def Cli.Cmd.mk (name : String) (version? : Option String) (description : String) (furtherInformation? : optParam (Option String) none) (flags : optParam (Array Cli.Flag) #[]) (positionalArgs : optParam (Array Cli.Arg) #[]) (variableArg? : optParam (Option Cli.Arg) none) (run : Cli.ParsedIO UInt32) (subCmds : optParam (Array Cli.Cmd) #[]) (extension? : optParam (Option Cli.Extension) none) :

                                                                                                                                                                                                                              Creates a new command. Adds a -h, --help and a --version flag if a version is designated. Updates the parentNames of all subcommands.

                                                                                                                                                                                                                              • name: Name that is displayed in the help.
                                                                                                                                                                                                                              • version?: Version that is displayed in the help and when the version is queried.
                                                                                                                                                                                                                              • description: Description that is displayed in the help.
                                                                                                                                                                                                                              • furtherInformation?: Information appended to the end of the help. Useful for command extensions.
                                                                                                                                                                                                                              • flags: Supported flags ("options" in standard terminology).
                                                                                                                                                                                                                              • positionalArgs: Supported positional arguments ("operands" in standard terminology).
                                                                                                                                                                                                                              • variableArg?: Variable argument at the end of the positional arguments.
                                                                                                                                                                                                                              • run: Handler to run when the command is called and flags/arguments have been successfully processed.
                                                                                                                                                                                                                              • subCmds: Subcommands.
                                                                                                                                                                                                                              • extension?: Extension of the Cli library.
                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                              • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                              Instances For

                                                                                                                                                                                                                                Finds the subcommand in c with the corresponding name.

                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                • c.subCmd? name = c.subCmds.find? fun (x : Cli.Cmd) => decide (x.meta.name = name)
                                                                                                                                                                                                                                Instances For

                                                                                                                                                                                                                                  Extension of the Cli library.

                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                  • c.extension! = c.extension?.get!
                                                                                                                                                                                                                                  Instances For

                                                                                                                                                                                                                                    Finds the subcommand in c with the corresponding name.

                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                    • c.subCmd! name = (c.subCmd? name).get!
                                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                                      def Cli.Cmd.hasSubCmd (c : Cli.Cmd) (name : String) :

                                                                                                                                                                                                                                      Checks whether c contains a subcommand with the corresponding name.

                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                      • c.hasSubCmd name = (c.subCmd? name).isSome
                                                                                                                                                                                                                                      Instances For

                                                                                                                                                                                                                                        Checks whether c is being extended.

                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                        • c.hasExtension = c.extension?.isSome
                                                                                                                                                                                                                                        Instances For

                                                                                                                                                                                                                                          Extracts meta and the recursive subcommand structure from c to create a Parsed.Cmd.

                                                                                                                                                                                                                                          Embeds c into a Cli.Cmd that does nothing.

                                                                                                                                                                                                                                          Embeds p.cmd into a Cli.Cmd that does nothing.

                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                          • p.toCmd = p.cmd.toFullCmd
                                                                                                                                                                                                                                          Instances For

                                                                                                                                                                                                                                            Creates a view of c that can be extended by extensions.

                                                                                                                                                                                                                                            Converts c back into a Cli.Cmd, using the extensions denoted in original.

                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                            • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                            Instances For

                                                                                                                                                                                                                                              Converts c back into Cli.Cmd while retaining none of the extensions.

                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                              Instances For
                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                Instances For
                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                  • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                  Instances For
                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                    • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                      • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                      Instances For
                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                        • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                          • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                          Instances For
                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                            • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                                                                              def Cli.expandPositionalArg (positionalArg : Lean.TSyntax `Cli.positionalArg) :
                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                              • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                              Instances For
                                                                                                                                                                                                                                                                def Cli.expandVariableArg (variableArg : Lean.TSyntax `Cli.variableArg) :
                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                Instances For
                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                  • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                  Instances For

                                                                                                                                                                                                                                                                    Maximum width within which all formatted text should fit.

                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                    Instances For

                                                                                                                                                                                                                                                                      Amount of spaces with which section content is indented.

                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                      Instances For

                                                                                                                                                                                                                                                                        Maximum width within which all formatted text should fit, after indentation.

                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                        Instances For

                                                                                                                                                                                                                                                                          Formats xs by String.optJoining the components with a single space.

                                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                                          Instances For

                                                                                                                                                                                                                                                                            Formats xs by String.optJoining the components with a newline \n.

                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                                                                                              def Cli.renderSection (title : String) (content : String) (emptyContentPlaceholder? : optParam (Option String) none) :

                                                                                                                                                                                                                                                                              Renders a help section with the designated title and content. If content = "", emptyContentPlaceholder? will be used instead. If emptyContentPlaceholder? = none, neither the title nor the content will be rendered.

                                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                                              • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                              Instances For
                                                                                                                                                                                                                                                                                def Cli.renderTable (title : String) (columns : Array (String × String)) (emptyTablePlaceholder? : optParam (Option String) none) :

                                                                                                                                                                                                                                                                                Renders a table using Cli.Array.renderTable! and then renders a section with the designated title and the rendered table as content.

                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                Instances For

                                                                                                                                                                                                                                                                                  Renders the help for c.

                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                  • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                  Instances For
                                                                                                                                                                                                                                                                                    def Cli.Cmd.error (c : Cli.Cmd) (msg : String) :

                                                                                                                                                                                                                                                                                    Renders an error for c with the designated message msg.

                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                    • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                    Instances For

                                                                                                                                                                                                                                                                                      Prints the help for c.

                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                      Instances For

                                                                                                                                                                                                                                                                                        Prints an error for c with the designated message msg.

                                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                                        Instances For

                                                                                                                                                                                                                                                                                          Prints the version of c. Panics if c has no version.

                                                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                                                          Instances For

                                                                                                                                                                                                                                                                                            Renders the help for p.cmd.

                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                            • p.help = p.toCmd.help
                                                                                                                                                                                                                                                                                            Instances For

                                                                                                                                                                                                                                                                                              Renders an error for p.cmd with the designated message msg.

                                                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                                                              • p.error msg = p.toCmd.error msg
                                                                                                                                                                                                                                                                                              Instances For

                                                                                                                                                                                                                                                                                                Prints the help for p.cmd.

                                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                                • p.printHelp = p.toCmd.printHelp
                                                                                                                                                                                                                                                                                                Instances For

                                                                                                                                                                                                                                                                                                  Prints an error for p.cmd with the designated message msg.

                                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                                  • p.printError msg = p.toCmd.printError msg
                                                                                                                                                                                                                                                                                                  Instances For

                                                                                                                                                                                                                                                                                                    Prints the version of p.cmd. Panics if p.cmd has no version.

                                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                                    • p.printVersion! = p.toCmd.printVersion!
                                                                                                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                                                                                                      structure Cli.InputFlag :

                                                                                                                                                                                                                                                                                                      Represents the exact representation of a flag as input by the user.

                                                                                                                                                                                                                                                                                                      • name : String

                                                                                                                                                                                                                                                                                                        Flag name input by the user.

                                                                                                                                                                                                                                                                                                      • isShort : Bool

                                                                                                                                                                                                                                                                                                        Whether the flag input by the user was a short one.

                                                                                                                                                                                                                                                                                                      Instances For
                                                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                                                        • One or more equations did not get rendered due to their size.

                                                                                                                                                                                                                                                                                                        Represents the kind of error that occured during parsing.

                                                                                                                                                                                                                                                                                                        Instances For

                                                                                                                                                                                                                                                                                                          Associated message of the error.

                                                                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                                                                          Instances For
                                                                                                                                                                                                                                                                                                            structure Cli.ParseError :

                                                                                                                                                                                                                                                                                                            Error that occured during parsing. Contains the command that the error occured in and the kind of the error.

                                                                                                                                                                                                                                                                                                            Instances For

                                                                                                                                                                                                                                                                                                              Parses args according to the specification provided in c, returning either a ParseError or the (sub)command that was called and the parsed content of the input. Note that args designates the list <foo> in somebinary <foo>.

                                                                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                                                                              Instances For

                                                                                                                                                                                                                                                                                                                Recursively applies extensions in all subcommands in c bottom-up and c itself.

                                                                                                                                                                                                                                                                                                                Processes args by applying all extensions in c, Cmd.parse?ing the input according to c and then applying the postprocessing extension of the respective (sub)command that was called. Note that args designates the list <foo> in somebinary <foo>. Returns either the (sub)command that an error occured in and the corresponding error message or the (sub)command that was called and the parsed input after postprocessing.

                                                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                Instances For

                                                                                                                                                                                                                                                                                                                  Validates args by Cmd.process?ing the input according to c. Note that args designates the list <foo> in somebinary <foo>. Prints the help or the version of the called (sub)command if the respective flag was passed and returns 0 for the exit code. If neither of these flags were passed and processing was successful, the run handler of the called command is executed. In the case of a processing error, the error is printed to stderr and an exit code of 1 is returned.

                                                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                                                  • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                  Instances For