CLI

Preface

Usage: pharaoh [OPTIONS] COMMAND1 [ARGS]... [COMMAND2 [ARGS]...]...

  Pharaoh Commandline Interface.

  Usage examples:

      pharaoh new -t pharaoh_testing.simple -c "{'a': 1}" --settings ../my_settings.yaml
      pharaoh add -n dummy1 -t pharaoh_testing.simple -c "{'test_name':'dummy'}"
      pharaoh generate
      pharaoh build
      pharaoh archive

  Multi-command chaining is also possible (all on one line):

      pharaoh new add --name dummy1 -t pharaoh_testing.simple -c "{'test_name':'dummy1'}"
       add --name dummy2 -t pharaoh_testing.simple -c "{'test_name':'dummy2'}"
       generate build archive -d "archives/myarchive.zip"

Options:
  -p, --path PATH  The path to the Pharaoh report directory (contains
                   pharaoh.yaml) or the path to pharaoh.yaml itself. If omitted,
                   the current working directory is used.
  --help           Show this message and exit.

Commands:
  add              Adds a new component to the Pharaoh project.
  add-template     Adds additional templates to an existing component, that...
  archive          Archives the report to a ZIP file.
  build            Executes report generation for the current project.
  env              Updates the projects settings.
  generate         Generates assets.
  info             Prints Pharaoh version information, e.g.
  new              Creates a new Pharaoh report skeleton.
  print-plugins    Prints all available plugins and their installation paths
  remove           Removes one or multiple existing components.
  show-report      Opens the generated report (if possible, e.g.
  update-resource  Updates a Resource from a project component by its alias.

The CLI may be used in different ways:

  • Through the PIP entrypoint pharaoh

    When you install Pharaoh via PIP, it will install a pharaoh.exe into your environment (<installdir>/Scripts).

    Once your environment is activated you can use the CLI via the pharaoh command. Some examples using CMD:

    cd "C:/projects/my_pharaoh_report"
    
    set PHARAOH.REPORT.TITLE="Some Title"
    
    pharaoh new
    pharaoh add --name dummy1 -t pharaoh_testing.simple --context "{'test_name':'dummy1'}"
    pharaoh add --name dummy2 -t pharaoh_testing.simple --context "{'test_name':'dummy2'}"
    pharaoh generate
    pharaoh build
    

    If you current working directory is not inside the Pharaoh project, add the absolute or relative (to CWD) path to the project as first argument like this:

    cd "C:/projects"
    
    pharaoh -p "my_pharaoh_report" new
    pharaoh -p "my_pharaoh_report" generate
    cd "my_pharaoh_report"
    pharaoh build
    
  • Through the generated CMD scripts report-project/*.cmd

    The advantage of those scripts is, that they are working regardless of your Pharaoh Python environment being activated or not, since they contain the absolute path to the Python interpreter used to generate them as a fallback .

    Thus they are checking if pharaoh.exe is on the system path (e.g. when executing inside an activated virtual env - like the terminal in PyCharm), but falling back to the absolute path.

    Important

    If you rename or move the Python environment that was used to generate the Pharaoh project, those CMD script won’t work anymore (unless pharaoh.exe is on the system path).

    So you can just double click pharaoh-*.cmd to perform the corresponding action with default arguments.

    Note

    This way is just used to managed an already existing Pharaoh project, so commands like pharaoh.cmd new does not really make sense.

    If you like to use them via the terminal, the syntax is similar to the above examples:

    • pharaoh.cmd generate or pharaoh-generate-assets.cmd

    • pharaoh.cmd build or pharaoh-build.cmd

    • pharaoh.cmd archive or pharaoh-archive.cmd

Commands

New

Usage: pharaoh new [OPTIONS]

  Creates a new Pharaoh report skeleton.

  Example:

      pharaoh new -t pharaoh_testing.simple -c "{'a': 1}" --settings ../my_settings.yaml

Options:
  -f, --force          Force project overwrite if already exists
  -t, --template TEXT  The project templates to use for creating the project
                       files.
  -c, --context TEXT   The Jinja rendering context for the selected template.
  -s, --settings FILE  A path to a YAML file containing settings to overwrite
                       the default project settings.
  --help               Show this message and exit.

Add

Usage: pharaoh add [OPTIONS]

  Adds a new component to the Pharaoh project.

  Example:

      pharaoh add -n dummy1 -t pharaoh_testing.simple -c "{'test_name':'dummy'}"
      pharaoh add -n dummy1 -t pharaoh_testing.simple -r "FileResource(alias='foo', pattern='.*')"

Options:
  -n, --name TEXT      The name of the component. Must be a valid Python
                       identifier.   [required]
  -t, --template TEXT  The component templates to use for creating the
                       components project files.
  -c, --context TEXT   The Jinja rendering context for the selected templates.
  -m, --metadata TEXT  A dictionary of metadata that may be used to find the
                       components.Enter a valid json string
  -r, --resource TEXT  A Python expression that evaluates to a valid object of
                       type Resource.
  -i, --index INTEGER  The index to add the component. Default is -1 with means
                       at the end.
  --help               Show this message and exit.

Update-resource

Usage: pharaoh update-resource [OPTIONS]

  Updates a Resource from a project component by its alias.

  Examples:

      pharaoh update-resource -n dummy1 -a foo -r "FileResource(alias='baz', pattern='*')"

Options:
  -n, --name TEXT      The name of the component. Must be a valid Python
                       identifier.   [required]
  -a, --alias TEXT     The resource alias.  [required]
  -r, --resource TEXT  A Python expression that evaluates to a valid object of
                       type Resource.
  --help               Show this message and exit.

Add-template

Usage: pharaoh add-template [OPTIONS]

  Adds additional templates to an existing component, that may overwrite
  existing files during rendering.

  Example:

      pharaoh add-template -n dummy1 -t pharaoh_testing.simple -c "{'test_name':'dummy'}"

Options:
  -n, --name TEXT      The name of the component. Must be a valid Python
                       identifier.   [required]
  -t, --template TEXT  The component templates to use for creating the
                       components project files.
  -c, --context TEXT   The Jinja rendering context for the selected templates.
  --help               Show this message and exit.

Remove

Usage: pharaoh remove [OPTIONS]

  Removes one or multiple existing components.

  If the regular expression (case-insensitive) partially matches the component
  name. To do a full match surround the pattern by ^ and &, e.g. ^my_component&.

  Example:

      pharaoh remove -f dummy.*

Options:
  -f, --filter TEXT  A case-insensitive component filter. Either a full- or
                     regular expression match, depending on regex option.
                     [required]
  -r, --regex        If True, the filter option will be treated as regular
                     expression. Components that partially match the regular
                     expression are removed.
  --help             Show this message and exit.

Env

Usage: pharaoh env [OPTIONS] KEY [VALUE]

  Updates the projects settings.

  Example:

      pharaoh env foo_A 123               -> foo_a: 123
      pharaoh env foo_B bar               -> foo_b: "bar"
      pharaoh env foo_C "{'baz': 123}"    -> foo_c: {'baz': 123}
      pharaoh env foo_D class             -> foo_d: "class"
      pharaoh env foo_E                   -> foo_e: None

Options:
  --help  Show this message and exit.

Generate

Usage: pharaoh generate [OPTIONS]

  Generates assets.  Either of the entire project or just a selected subset of
  components.

  Examples:

      pharaoh generate
      pharaoh generate -f dummy[12]
      pharaoh generate -f dummy1 -f dummy2

Options:
  -f, --filter TEXT  A list of regular expressions that are matched against each
                     component name. If a component name matches any of the
                     regular expressions, the component's assets are regenerated
                     (containing directory will be cleared)
  --help             Show this message and exit.

Build

Usage: pharaoh build [OPTIONS]

  Executes report generation for the current project.

  Examples:

      pharaoh build
      pharaoh -p "path/to/my/project" build

Options:
  --help  Show this message and exit.

Show-report

Usage: pharaoh show-report [OPTIONS]

  Opens the generated report (if possible, e.g. for local HTML reports).

  Examples:

      pharaoh show-report
      pharaoh -p "path/to/my/project" show-report

Options:
  --help  Show this message and exit.

Archive

Usage: pharaoh archive [OPTIONS]

  Archives the report to a ZIP file.

Options:
  -d, --dest PATH  Path to the archive. Either a directory or filename with
                   extension zip.
  --help           Show this message and exit.

Info

Usage: pharaoh info [OPTIONS]

  Prints Pharaoh version information, e.g. ``Pharaoh v1.0.0 [Python 3.9.13,
  Windows-10-10.0.19045-SP0]``

Options:
  --help  Show this message and exit.