arc/docs/configuration.md

64 lines
2.3 KiB
Markdown

# Configuration
Arc uses YAML configuration files.
```yaml
user:
name: hanna
email: me@hanna.lol
key: ~/.ssh/id_ed25519
default:
bookmark: main
remote: origin
aliases:
c: commit
p: push
l: pull
```
## File Locations
- **Local config**: `.arc/config.yml` inside the repository. Created automatically on `arc init` with default bookmark/remote values.
- **Global config**: `$XDG_CONFIG_HOME/arc/config.yml`, or `~/.config/arc/config.yml` if `XDG_CONFIG_HOME` is not set.
## Resolution Order
Local config values take priority over global config values. For each field, the local value is checked first; if not set, the global value is used. Aliases from both configs are merged, with local aliases overriding global ones with the same name.
## Sections
### `user`
| Key | Description |
|---|---|
| `user.name` | Author name for commits. |
| `user.email` | Author email for commits. Both name and email must be set for author info to appear on commits. |
| `user.key` | Path to an SSH private key for commit signing (e.g. `~/.ssh/id_ed25519`). Tilde expansion (`~`) is supported. When set, commits are automatically signed. |
### `default`
| Key | Description |
|---|---|
| `default.bookmark` | Default bookmark name (used on init). Defaults to `main`. |
| `default.remote` | Default remote name (used by push/pull/sync). Defaults to `origin`. |
### `aliases`
Maps short names to command names. For example, `aliases.c: commit` lets you run `arc c "message"` instead of `arc commit "message"`. Aliases are expanded at the CLI level before command dispatch. Any alias key is valid; the value should be a valid arc command name.
## Commands
```
arc config set <key> <value> Set a local config value.
arc config set -g <key> <value> Set a global config value.
arc config get <key> Get a value (local first, then global).
arc config get -g <key> Get a value from global config only.
arc config show Show the effective (merged) configuration.
arc config show -g Show only the global configuration.
arc config unset <key> Remove a key from local config.
arc config unset -g <key> Remove a key from global config.
```
Keys use dot notation: `section.field` (e.g. `user.name`, `default.remote`, `aliases.st`).