Skip to content

Configuration

Mikhail Deynekin edited this page Oct 12, 2026 · 2 revisions

Файлы конфигурации

Configuration files

Configuration files

Precedence, lowest to highest:

  1. built-in defaults
  2. /etc/sr/sr.conf system wide
  3. $XDG_CONFIG_HOME/sr/sr.conf user (default ~/.config/sr/sr.conf)
  4. /.srrc, /.srrc, project (walked upwards, stops at /.sr/sr.conf the repository boundary)
  5. $SR_CONFIG an extra file
  6. --config-file FILE an extra file, explicitly
  7. SR_* environment variables
  8. --config KEY=VALUE
  9. command line flags

Syntax — a small, forgiving INI dialect:

# a comment
ignore-case = true          # applies to every command
exclude = *.min.js, dist    # comma or whitespace separated list

[replace]                   # applies to `sr replace` only
backup = false
confirm-threshold = 500

[find]
context = 1

Rules:

  • keys are the option names ('-' and '_' are interchangeable)
  • key alone means key = true
  • booleans accept true/false/yes/no/on/off/1/0
  • sizes accept 512, 4KB, 10MB, 1.5GiB; durations accept 30s, 5m, 7d
  • repeating a key builds a list
  • an unknown key or an invalid value is a hard error with file:line — a silently ignored typo is exactly what a bulk-edit tool must not have

Commands:

sr config list --show-origin every option, its value, where it came from sr config show confirm-threshold sr config init write a documented template sr config init --file .srrc …into the project instead sr config path the files sr would read, in order sr config validate parse every file and report errors

A project .srrc is worth committing: it makes the team's exclusion list, confirmation threshold and backup policy part of the repository instead of tribal knowledge.


Страница сгенерирована из встроенной справки sr 7.0.1 (sr help <topic>). Первоисточник — sr/help_system.py; он же питает man sr и sr help --all. Если страница и вывод sr help расходятся, верить нужно sr help: он всегда соответствует установленной версии.

Clone this wiki locally