комментарии и сообщения переведены на английский

- комментарии, тексты ошибок, вывод CLI и сообщения тестов теперь на английском
- по-русски остались только литералы словаря ru и содержимое фикстур: это
  данные под проверкой, а не текст инструмента
- согласование числительных в итоге упростилось до английского plural
This commit is contained in:
av
2026-07-27 10:04:27 +03:00
parent 0b8cc125b3
commit b2d07ae55d
17 changed files with 548 additions and 524 deletions
+30 -30
View File
@@ -1,10 +1,10 @@
// Package cli раскладывает команды инструмента.
// Package cli lays out the commands of the tool.
//
// Глубина команды отражает частоту и адресата: проектные команды выполняются в
// каждом репозитории и часто, ведение набора — в одном репозитории и редко.
// Поэтому `check` стоит наверху, а под `suite` уходит то, что в проекте не
// имеет смысла. Синонимов нет: `convy suite pull` рядом с `convy pull` не
// заводится.
// The depth of a command reflects how often it runs and whom it addresses:
// project commands run in every repository and often, tending a suite runs in
// one repository and rarely. That is why `check` stays at the top level and
// whatever makes no sense in a project goes under `suite`. There are no
// synonyms: `convy suite pull` is not introduced next to `convy pull`.
package cli
import (
@@ -13,19 +13,20 @@ import (
"os"
)
// ExitCode — код возврата процесса.
// ExitCode is the exit status of the process.
type ExitCode int
const (
// OK — проверка прошла, работа сделана.
// OK means the check passed and the work is done.
OK ExitCode = 0
// Failed — проверка нашла ошибки.
// Failed means the check found errors.
Failed ExitCode = 1
// Usage — команда набрана неверно или не в том контексте.
// Usage means the command was typed wrong or run in the wrong context.
Usage ExitCode = 2
)
// Env — окружение запуска. Вынесено, чтобы команды тестировались без процесса.
// Env is the environment of a run. It is pulled out so that commands can be
// tested without a process.
type Env struct {
Dir string
Out io.Writer
@@ -34,7 +35,7 @@ type Env struct {
Colors bool
}
// Run разбирает аргументы и выполняет команду.
// Run parses the arguments and executes the command.
func Run(env Env, args []string) ExitCode {
if len(args) == 0 {
usage(env.Out)
@@ -45,13 +46,13 @@ func Run(env Env, args []string) ExitCode {
case "suite":
return runSuite(env, args[1:])
case "add", "pull", "list", "check":
fmt.Fprintf(env.Err, "команда %q ещё не реализована\n", args[0])
fmt.Fprintf(env.Err, "the %q command is not implemented yet\n", args[0])
return Usage
case "help", "-h", "--help":
usage(env.Out)
return OK
default:
fmt.Fprintf(env.Err, "неизвестная команда %q\n\n", args[0])
fmt.Fprintf(env.Err, "unknown command %q\n\n", args[0])
usage(env.Err)
return Usage
}
@@ -59,44 +60,43 @@ func Run(env Env, args []string) ExitCode {
func runSuite(env Env, args []string) ExitCode {
if len(args) == 0 {
fmt.Fprintln(env.Err, "convy suite: нужна подкоманда — check")
fmt.Fprintln(env.Err, "convy suite: a subcommand is required — check")
return Usage
}
switch args[0] {
case "check":
return runSuiteCheck(env, args[1:])
case "new":
fmt.Fprintln(env.Err, "команда \"suite new\" ещё не реализована")
fmt.Fprintln(env.Err, "the \"suite new\" command is not implemented yet")
return Usage
default:
fmt.Fprintf(env.Err, "неизвестная подкоманда %q для convy suite\n", args[0])
fmt.Fprintf(env.Err, "unknown subcommand %q for convy suite\n", args[0])
return Usage
}
}
// usage печатает помощь, сгруппированную заголовками: в плоском списке уровни
// не видны.
// usage prints the help grouped under headings: a flat list hides the levels.
func usage(w io.Writer) {
fmt.Fprint(w, `convy — управление конвенциями разработки.
fmt.Fprint(w, `convy — tending development conventions.
В проекте:
convy add <тема> подписаться и собрать (не реализовано)
convy pull пересобрать подписанное (не реализовано)
convy list что подключено и что доступно (не реализовано)
convy check проверить форму того, что здесь (не реализовано)
In a project:
convy add <topic> subscribe and assemble (not implemented)
convy pull reassemble what is subscribed (not implemented)
convy list what is wired up and available (not implemented)
convy check check the form of what is here (not implemented)
В наборе:
convy suite check целостность набора: префиксы, темы, оси, ссылки, форма
convy suite new новая тема (не реализовано)
In a suite:
convy suite check suite integrity: prefixes, topics, axes, links, form
convy suite new a new topic (not implemented)
`)
}
// Main — точка входа процесса.
// Main is the entry point of the process.
func Main() int {
dir, err := os.Getwd()
if err != nil {
fmt.Fprintln(os.Stderr, "не удалось определить текущую директорию:", err)
fmt.Fprintln(os.Stderr, "cannot determine the current directory:", err)
return int(Usage)
}
env := Env{Dir: dir, Out: os.Stdout, Err: os.Stderr}