# CLI
`cert-monitor` comes with a rich CLI power by [https://github.com/spf13/cobra](https://github.com/spf13/cobra), and thus comes will built in help and completion. 
## Getting Help
Running without argument will display the help page. 
```bash
cert-monitor
```
display
```      
A tool to discover, display, and monitor 
x509 certificates as prometheus metrics
Usage:
  cert-monitor [flags]
  cert-monitor [command]
Available Commands:
  completion    Generate the autocompletion script for the specified shell
  documentation Generate Markdown doc for cert-monitor
  fetch         fetch certificate from remote sources
  help          Help about any command
  server        Starts the cert-monitor prometheus server
  version       Print the version number of cert-monitor
Flags:
  -d, --debug   debug mode enabled
  -h, --help    help for cert-monitor
Use "cert-monitor [command] --help" for more information about a command.
```
### The `help` subcommand
Use `help [subcommand]` to display help for subcommands
```bash
cert-monitor help fetch
```
```
fetch certificate from remote sources
Usage:
  cert-monitor fetch [flags]
  cert-monitor fetch [command]
Available Commands:
  jwk         fetch certificates from remote JWKs endpoint
  saml        fetch certificates from remote SAML metadata
  tcp         fetch certificates from remote tcp endpoint
  tls         fetch certificates from remote TLS url
Flags:
  -h, --help                  help for fetch
  -i, --index int             Index from certificate list (default -1)
      --no-color              Disable color output
      --no-text               Don't display test (only PEM)
      --skew int              Days to check for expiration (default 90)
      --skip-tls-validation   Skip TLS certificate validation
Global Flags:
  -d, --debug   debug mode enabled
Use "cert-monitor fetch [command] --help" for more information about a command.
```
## Completion
Follow the instruction generated by the `help  completion` for your corresponding shell:
=== "zsh"
    ```
    cert-monitor help  completion zsh
    ```
    ```
    Generate the autocompletion script for the zsh shell.
    If shell completion is not already enabled in your environment you will need
    to enable it.  You can execute the following once:
        echo "autoload -U compinit; compinit" >> ~/.zshrc
    To load completions for every new session, execute once:
    #### Linux:
        cert-monitor completion zsh > "${fpath[1]}/_cert-monitor"
    #### macOS:
        cert-monitor completion zsh > /usr/local/share/zsh/site-functions/_cert-monitor
    You will need to start a new shell for this setup to take effect.
    ```
=== "bash"
    ```
    cert-monitor help  completion bash
    ```
    ```
    Generate the autocompletion script for the bash shell.
    This script depends on the 'bash-completion' package.
    If it is not installed already, you can install it via your OS's package manager.
    To load completions in your current shell session:
        source <(cert-monitor completion bash)
    To load completions for every new session, execute once:
    #### Linux:
        cert-monitor completion bash > /etc/bash_completion.d/cert-monitor
    #### macOS:
        cert-monitor completion bash > /usr/local/etc/bash_completion.d/cert-monitor
    You will need to start a new shell for this setup to take effect.

    ```

=== "Powershell"
    ```
    cert-monitor help  completion powershell
    ```
    ```
    Generate the autocompletion script for powershell.
    To load completions in your current shell session:
        cert-monitor completion powershell | Out-String | Invoke-Expression
    To load completions for every new session, add the output of the above command
    to your powershell profile.
    ```
=== "fish"
    ```
    cert-monitor help  completion fish
    ```
    ```
    Generate the autocompletion script for the fish shell.
    To load completions in your current shell session:
        cert-monitor completion fish | source
    To load completions for every new session, execute once:
        cert-monitor completion fish > ~/.config/fish/completions/cert-monitor.fish
    You will need to start a new shell for this setup to take effect.
    ```
## CLI Docs
You can find the markdown CLI docs on the main [github repo](https://github.com/vdbulcke/cert-monitor/tree/master/doc/cert-monitor.md).