Documentation

Lake.Util.Cli

Defines the abstract CLI interface for Lake.

Types #

Equations
    Instances For
      @[inline]
      Equations
        Instances For
          @[reducible, inline]
          abbrev Lake.ArgsT (m : TypeType u_1) (α : Type) :
          Type u_1
          Equations
            Instances For
              @[inline]
              def Lake.ArgsT.run {m : TypeType u_1} {α : Type} (args : List String) (self : ArgsT m α) :
              m (α × List String)
              Equations
                Instances For
                  @[inline]
                  def Lake.ArgsT.run' {m : TypeType u_1} {α : Type} [Functor m] (args : List String) (self : ArgsT m α) :
                  m α
                  Equations
                    Instances For
                      structure Lake.OptionHandlers (m : Type u → Type v) (α : Type u) :
                      • long : Stringm α

                        Process a long option (ex. --long or "--long foo bar").

                      • short : Charm α

                        Process a short option (ex. -x or --).

                      • longShort : Stringm α

                        Process a long short option (ex. -long, -xarg, -xyz).

                      Instances For

                        Utilities #

                        @[inline]
                        def Lake.getArgs {m : TypeType u_1} [MonadStateOf ArgList m] :

                        Get the remaining argument list.

                        Equations
                          Instances For
                            @[inline]
                            def Lake.setArgs {m : TypeType u_1} [MonadStateOf ArgList m] (args : List String) :

                            Replace the argument list.

                            Equations
                              Instances For
                                @[inline]

                                Take the head of the remaining argument list (or none if empty).

                                Equations
                                  Instances For
                                    @[inline]
                                    def Lake.takeArgD {m : TypeType u_1} [MonadStateOf ArgList m] (default : String) :

                                    Take the head of the remaining argument list (or default if none).

                                    Equations
                                      Instances For
                                        @[inline]

                                        Take the remaining argument list, leaving only an empty list.

                                        Equations
                                          Instances For
                                            @[inline]
                                            def Lake.consArg {m : TypeType u_1} [MonadStateOf ArgList m] (arg : String) :

                                            Add a string to the head of the remaining argument list.

                                            Equations
                                              Instances For
                                                @[inline]
                                                def Lake.shortOptionWithEq {m : TypeType u_1} [Monad m] [MonadStateOf ArgList m] {α : Type} (handle : Charm α) (opt : String) :
                                                m α

                                                Process a short option of the form -x=arg.

                                                Equations
                                                  Instances For
                                                    @[inline]
                                                    def Lake.shortOptionWithSpace {m : TypeType u_1} [Monad m] [MonadStateOf ArgList m] {α : Type} (handle : Charm α) (opt : String) :
                                                    m α

                                                    Process a short option of the form "-x arg".

                                                    Equations
                                                      Instances For
                                                        @[inline]
                                                        def Lake.shortOptionWithArg {m : TypeType u_1} [Monad m] [MonadStateOf ArgList m] {α : Type} (handle : Charm α) (opt : String) :
                                                        m α

                                                        Process a short option of the form -xarg.

                                                        Equations
                                                          Instances For
                                                            @[inline]
                                                            def Lake.multiShortOption {m : TypeType u_1} [Monad m] (handle : Charm PUnit) (opt : String) :

                                                            Process a multiple short options grouped together (ex. -xyz as x, y, z).

                                                            Equations
                                                              Instances For
                                                                @[inline]
                                                                def Lake.longOptionOrSpace {m : TypeType u_1} [Monad m] [MonadStateOf ArgList m] {α : Type} (handle : Stringm α) (opt : String) :
                                                                m α

                                                                Splits a long option of the form "--long foo bar" into --long and "foo bar".

                                                                Equations
                                                                  Instances For
                                                                    @[inline]
                                                                    def Lake.longOptionOrEq {m : TypeType u_1} [Monad m] [MonadStateOf ArgList m] {α : Type} (handle : Stringm α) (opt : String) :
                                                                    m α

                                                                    Splits a long option of the form --long=arg into --long and arg.

                                                                    Equations
                                                                      Instances For
                                                                        @[inline]
                                                                        def Lake.longOption {m : TypeType u_1} [Monad m] [MonadStateOf ArgList m] {α : Type} (handle : Stringm α) :
                                                                        Stringm α

                                                                        Process a long option of the form --long, --long=arg, "--long arg".

                                                                        Equations
                                                                          Instances For
                                                                            @[inline]
                                                                            def Lake.shortOption {m : TypeType u_1} [Monad m] [MonadStateOf ArgList m] {α : Type} (shortHandle : Charm α) (longHandle : Stringm α) (opt : String) :
                                                                            m α

                                                                            Process a short option of the form -x, -x=arg, -x arg, or -long.

                                                                            Equations
                                                                              Instances For
                                                                                @[inline]
                                                                                def Lake.option {m : TypeType u_1} [Monad m] [MonadStateOf ArgList m] {α : Type} (handlers : OptionHandlers m α) (opt : String) :
                                                                                m α

                                                                                Process an option, short or long, using the given handlers. An option is an argument of length > 1 starting with a dash (-). An option may consume additional elements of the argument list.

                                                                                Equations
                                                                                  Instances For
                                                                                    def Lake.processLeadingOption {m : TypeType u_1} [Monad m] [MonadStateOf ArgList m] (handle : Stringm PUnit) :

                                                                                    Process the head argument of the list using handle if it is an option.

                                                                                    Equations
                                                                                      Instances For
                                                                                        partial def Lake.processLeadingOptions {m : TypeType u_1} [Monad m] [MonadStateOf ArgList m] (handle : Stringm PUnit) :

                                                                                        Process the leading options of the remaining argument list. Consumes empty leading arguments in the argument list.

                                                                                        partial def Lake.collectArgs {m : TypeType u_1} [Monad m] [MonadStateOf ArgList m] (option : Stringm PUnit) (args : Array String := #[]) :

                                                                                        Process every option and collect the remaining arguments into an Array.

                                                                                        @[inline]
                                                                                        def Lake.processOptions {m : TypeType u_1} [Monad m] [MonadStateOf ArgList m] (handle : Stringm PUnit) :

                                                                                        Process every option in the argument list.

                                                                                        Equations
                                                                                          Instances For