Skip to content

Configuration

Brandon Davis edited this page Oct 28, 2018 · 4 revisions

Overview

Upon initial startup Slacker will write a configuration file to keep state between subsequent runs. Slacker CLI exposes a config command for viewing the currently loaded configuration file, setting "read-only" mode, and resetting the configuration file to default values.

Slacker> config -h
usage: config [-h] [--set-read-only] [--unset-read-only] [--reset]

Shows current config state.
https://github.com/netromdk/slacker/wiki/Configuration

optional arguments:
  -h, --help         show this help message and exit
  --set-read-only    Set read-only mode.
  --unset-read-only  Unset read-only mode.
  --reset            Reset all config values to default and exit slacker (be
                     careful!).

Config format & location

Slacker uses JSON format for reading/writing configuration information and is loaded from ~/.slacker.

Config file location is non-configurable at the moment, although it would be trivial to add support for it via startup flag.

Config fields

Name Default Description
repl_prompt ${ro}${w}> Template string controlling the prompt
workspaces set on initial startup Slack workspace name:token pairs
active_workspace set on initial startup Active Slack workspace
log_level 20(INFO) Log level numeric value (Levels)
read_only False Destructive commands are not executed
read_only_str (read-only) Displayed in the prompt when read-only mode

Custom REPL prompt

Slacker exposes the ability to configure the REPL prompt string. The prompt template string is read from the configuration file field repl_prompt.

Default prompt template string is configured to ${ro}${w}> .

Identifier Description
${w} Active Slack workspace name
${ro} Display read_only_str config field when read-only is enabled