Face

Contents:

  • Tutorial
    • Part I: Say
      • Positional arguments
      • Flags
      • Flags with values
      • More Interesting Flag Types
    • Part II: Calc
      • Add and Multiply
      • Subtract
      • Divide
      • Precision support
    • Part III: Middleware
    • Part IV: Examples
      • Cut MP4
      • Glom
      • Pocket Protector
      • Montage Admin Tools
  • Command
    • Construction
    • Adding flags
      • Required flags
      • ListParam and ChoicesParam
    • Adding subcommands
    • Positional arguments
    • Adding middleware
    • Running
    • Dependency injection
    • Error handling
    • API reference
      • Command
        • Command.add()
        • Command.add_command()
        • Command.add_middleware()
        • Command.get_dep_names()
        • Command.get_flag_map()
        • Command.prepare()
        • Command.run()
      • Command Exception Types
        • CommandLineError
        • UsageError
  • Parser
    • Parser
      • Parser
        • Parser.add()
        • Parser.parse()
    • Flag
      • Flag
    • FlagDisplay
      • FlagDisplay
    • PosArgSpec
      • PosArgSpec
        • PosArgSpec.accepts_args
        • PosArgSpec.parse()
    • PosArgDisplay
      • PosArgDisplay
    • ListParam
      • ListParam
    • ChoicesParam
      • ChoicesParam
    • CommandParseResult
      • CommandParseResult
        • CommandParseResult.to_cmd_scope()
    • ERROR Sentinel
  • Middleware
    • Basic middleware
    • Providing values
    • Middleware with flags
    • Optional middleware
    • Weak dependencies
    • API Reference
      • face_middleware()
      • is_middleware()
      • check_middleware()
  • Testing
    • Basic usage
    • Testing failures
    • Environment and directory isolation
    • Testing stdin and prompts
    • RunResult reference
      • RunResult
        • RunResult.args
        • RunResult.input
        • RunResult.exit_code
        • RunResult.stdout
        • RunResult.stderr
        • RunResult.stdout_bytes
        • RunResult.stderr_bytes
        • RunResult.returncode
        • RunResult.exc_info
        • RunResult.exception
    • CheckError reference
      • CheckError
    • CommandChecker reference
      • CommandChecker
        • CommandChecker.run()
        • CommandChecker.fail()
        • CommandChecker.fail_X()
  • Input / Output
    • echo()
    • echo_err()
    • prompt()
    • prompt_secret()
  • Errors
    • Exception hierarchy
    • Parse errors
      • FaceException
      • ArgumentParseError
      • ArgumentArityError
      • InvalidSubcommand
      • UnknownFlag
      • InvalidFlagArgument
      • InvalidPositionalArgument
      • MissingRequiredFlags
      • DuplicateFlag
      • Parse errors in practice
    • Runtime errors
  • Face FAQs
    • What sets Face apart from other CLI libraries?
    • Why is Face so picky about argument order?
    • Any recommended patterns for laying out CLI code?
    • How does dependency injection work?
    • How do I make a flag required?
    • How do I accept multiple values for a flag?
Face
  • Overview: module code

All modules for which code is available

  • face.command
  • face.errors
  • face.middleware
  • face.parser
  • face.testing
  • face.utils

© Copyright 2026, Mahmoud Hashemi.

Built with Sphinx using a theme provided by Read the Docs.