diff --git a/assets/logo.png b/assets/logo.png index 55c34ae..7176b54 100644 Binary files a/assets/logo.png and b/assets/logo.png differ diff --git a/build.go b/build.go index 91f30fd..c9fb303 100644 --- a/build.go +++ b/build.go @@ -200,7 +200,7 @@ func BuildCmd() *cli.Command { // Проверяем, существует ли файл перед перемещением if _, err := os.Stat(pkg.Path); os.IsNotExist(err) { - slog.Info("Package file already moved or removed, skipping", "path", pkg.Path) + slog.Info(gotext.Get("Package file already moved or removed, skipping"), "path", pkg.Path) continue } diff --git a/config.go b/config.go index 50da8ea..a321a6f 100644 --- a/config.go +++ b/config.go @@ -38,6 +38,24 @@ func ConfigCmd() *cli.Command { ShowCmd(), SetConfig(), GetConfig(), + ConfigHelpCmd(), + }, + } +} + +func ConfigHelpCmd() *cli.Command { + return &cli.Command{ + Name: "help", + Aliases: []string{"h"}, + Usage: gotext.Get("Shows a list of commands or help for one command"), + ArgsUsage: "[command]", + Action: func(cCtx *cli.Context) error { + args := cCtx.Args() + if args.Present() { + return cli.ShowCommandHelp(cCtx, args.First()) + } + cli.ShowSubcommandHelp(cCtx) + return nil }, } } diff --git a/go.mod b/go.mod index b0f26ad..442a065 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,7 @@ go 1.24.4 require ( gitea.plemya-x.ru/Plemya-x/fakeroot v0.0.2-0.20250408104831-427aaa7713c3 + gitea.plemya-x.ru/xpamych/vercmp v0.0.1 github.com/AlecAivazis/survey/v2 v2.3.7 github.com/PuerkitoBio/purell v1.2.0 github.com/alecthomas/chroma/v2 v2.9.1 @@ -36,7 +37,6 @@ require ( github.com/vmihailenco/msgpack/v5 v5.3.5 go.alt-gnome.ru/capytest v0.0.3-0.20250706082755-f20413e052f9 go.alt-gnome.ru/capytest/providers/podman v0.0.3-0.20250706082755-f20413e052f9 - go.elara.ws/vercmp v0.0.0-20230622214216-0b2b067575c4 golang.org/x/crypto v0.36.0 golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 golang.org/x/sys v0.33.0 diff --git a/go.sum b/go.sum index d77b9ea..155a3ba 100644 --- a/go.sum +++ b/go.sum @@ -21,6 +21,8 @@ gitea.com/xorm/sqlfiddle v0.0.0-20180821085327-62ce714f951a h1:lSA0F4e9A2NcQSqGq gitea.com/xorm/sqlfiddle v0.0.0-20180821085327-62ce714f951a/go.mod h1:EXuID2Zs0pAQhH8yz+DNjUbjppKQzKFAn28TMYPB6IU= gitea.plemya-x.ru/Plemya-x/fakeroot v0.0.2-0.20250408104831-427aaa7713c3 h1:56BjRJJ2Sv50DfSvNUydUMJwwFuiBMWC1uYtH2GYjk8= gitea.plemya-x.ru/Plemya-x/fakeroot v0.0.2-0.20250408104831-427aaa7713c3/go.mod h1:iKQM6uttMJgE5CFrPw6SQqAV7TKtlJNICRAie/dTciw= +gitea.plemya-x.ru/xpamych/vercmp v0.0.1 h1:tFQzsPfnQQDQ3jrqW0UwUSbK+HwJuq0sA0GfnvIkatw= +gitea.plemya-x.ru/xpamych/vercmp v0.0.1/go.mod h1:z9qQ4QJDou1AULVKPIW5blu/jT+O3O5HpTV8aujWSIM= github.com/AlecAivazis/survey/v2 v2.3.7 h1:6I/u8FvytdGsgonrYsVn2t8t4QiRnh6QSTqkkhIiSjQ= github.com/AlecAivazis/survey/v2 v2.3.7/go.mod h1:xUTIdE4KCOIjsBAE1JYsUPoCqYdZ1reCfTwbto0Fduo= github.com/AlekSi/pointer v1.2.0 h1:glcy/gc4h8HnG2Z3ZECSzZ1IX1x2JxRVuDzaJwQE0+w= @@ -432,14 +434,10 @@ github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsr github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= gitlab.com/digitalxero/go-conventional-commit v1.0.7 h1:8/dO6WWG+98PMhlZowt/YjuiKhqhGlOCwlIV8SqqGh8= gitlab.com/digitalxero/go-conventional-commit v1.0.7/go.mod h1:05Xc2BFsSyC5tKhK0y+P3bs0AwUtNuTp+mTpbCU/DZ0= -go.alt-gnome.ru/capytest v0.0.2 h1:clmvIqmYS86hhA1rsvivSSPpfOFkJTpbn38EQP7I3E8= -go.alt-gnome.ru/capytest v0.0.2/go.mod h1:lvxPx3H6h+LPnStBFblgoT2wkjv0wbug3S14troykEg= go.alt-gnome.ru/capytest v0.0.3-0.20250706082755-f20413e052f9 h1:NST+V5LV/eLgs0p6PsuvfHiZ4UrIWqftCdifO8zgg0g= go.alt-gnome.ru/capytest v0.0.3-0.20250706082755-f20413e052f9/go.mod h1:qiM8LARP+JBZr5mrDoVylOoqjrN0MAzvZ21NR9qMc0Y= go.alt-gnome.ru/capytest/providers/podman v0.0.3-0.20250706082755-f20413e052f9 h1:VZclgdJxARvhZ6PIWWW2hQ6Ge4XeE36pzUr/U/y62bE= go.alt-gnome.ru/capytest/providers/podman v0.0.3-0.20250706082755-f20413e052f9/go.mod h1:Wpq1Ny3eMzADJpMJArA2TZGZbsviUBmawtEPcxnoerg= -go.elara.ws/vercmp v0.0.0-20230622214216-0b2b067575c4 h1:Ep54XceQlKhcCHl9awG+wWP4kz4kIP3c3Lzw/Gc/zwY= -go.elara.ws/vercmp v0.0.0-20230622214216-0b2b067575c4/go.mod h1:/7PNW7nFnDR5W7UXZVc04gdVLR/wBNgkm33KgIz0OBk= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= diff --git a/helper.go b/helper.go index 89b8fe8..bfd3f0f 100644 --- a/helper.go +++ b/helper.go @@ -49,11 +49,26 @@ func HelperCmd() *cli.Command { }, } + helperHelpCmd := &cli.Command{ + Name: "help", + Aliases: []string{"h"}, + Usage: gotext.Get("Shows a list of commands or help for one command"), + ArgsUsage: "[command]", + Action: func(cCtx *cli.Context) error { + args := cCtx.Args() + if args.Present() { + return cli.ShowCommandHelp(cCtx, args.First()) + } + cli.ShowSubcommandHelp(cCtx) + return nil + }, + } + return &cli.Command{ Name: "helper", Usage: gotext.Get("Run a ALR helper command"), ArgsUsage: ``, - Subcommands: []*cli.Command{helperListCmd}, + Subcommands: []*cli.Command{helperListCmd, helperHelpCmd}, Flags: []cli.Flag{ &cli.StringFlag{ Name: "dest-dir", @@ -100,7 +115,6 @@ func HelperCmd() *cli.Command { return helper(hc, c.Args().First(), c.Args().Slice()[1:]) }, - CustomHelpTemplate: cli.CommandHelpTemplate, BashComplete: func(ctx *cli.Context) { for name := range helpers.Helpers { fmt.Println(name) diff --git a/internal.go b/internal.go index eeec206..0a91fc6 100644 --- a/internal.go +++ b/internal.go @@ -32,6 +32,7 @@ import ( "gitea.plemya-x.ru/Plemya-x/ALR/internal/config" "gitea.plemya-x.ru/Plemya-x/ALR/internal/logger" "gitea.plemya-x.ru/Plemya-x/ALR/internal/manager" + "gitea.plemya-x.ru/Plemya-x/ALR/internal/translations" "gitea.plemya-x.ru/Plemya-x/ALR/internal/utils" ) @@ -42,6 +43,7 @@ func InternalBuildCmd() *cli.Command { Hidden: true, Action: func(c *cli.Context) error { logger.SetupForGoPlugin() + translations.Setup() slog.Debug("start _internal-safe-script-executor", "uid", syscall.Getuid(), "gid", syscall.Getgid()) @@ -81,7 +83,7 @@ func InternalReposCmd() *cli.Command { Hidden: true, Action: utils.RootNeededAction(func(ctx *cli.Context) error { logger.SetupForGoPlugin() - + translations.Setup() deps, err := appbuilder. New(ctx.Context). @@ -115,6 +117,7 @@ func InternalInstallCmd() *cli.Command { Hidden: true, Action: func(c *cli.Context) error { logger.SetupForGoPlugin() + translations.Setup() // Запуск от текущего пользователя, повышение прав будет через sudo при необходимости diff --git a/internal/build/build.go b/internal/build/build.go index 46747de..e8037f7 100644 --- a/internal/build/build.go +++ b/internal/build/build.go @@ -583,6 +583,12 @@ func (b *Builder) BuildALRDeps( input.BuildOpts().Interactive, true, ) + + pkgs, err = b.installerExecutor.FilterPackagesByVersion(ctx, pkgs, input.OSRelease()) + if err != nil { + return nil, nil, fmt.Errorf("failed to filter packages by version: %w", err) + } + type item struct { pkg *alrsh.Package packages []string diff --git a/internal/build/installer.go b/internal/build/installer.go index 80973d5..571e586 100644 --- a/internal/build/installer.go +++ b/internal/build/installer.go @@ -18,8 +18,16 @@ package build import ( "context" + "fmt" + "log/slog" + + "github.com/leonelquinteros/gotext" + "gitea.plemya-x.ru/xpamych/vercmp" "gitea.plemya-x.ru/Plemya-x/ALR/internal/manager" + "gitea.plemya-x.ru/Plemya-x/ALR/internal/overrides" + "gitea.plemya-x.ru/Plemya-x/ALR/pkg/alrsh" + "gitea.plemya-x.ru/Plemya-x/ALR/pkg/distro" ) func NewInstaller(mgr manager.Manager) *Installer { @@ -58,3 +66,44 @@ func (i *Installer) RemoveAlreadyInstalled(ctx context.Context, pkgs []string) ( return filteredPackages, nil } + +func (i *Installer) FilterPackagesByVersion(ctx context.Context, packages []alrsh.Package, osRelease *distro.OSRelease) ([]alrsh.Package, error) { + installedPkgs, err := i.mgr.ListInstalled(nil) + if err != nil { + return nil, fmt.Errorf("failed to list installed packages: %w", err) + } + + var filteredPackages []alrsh.Package + + for _, pkg := range packages { + alrPkgName := fmt.Sprintf("%s+%s", pkg.Name, pkg.Repository) + installedVer, isInstalled := installedPkgs[alrPkgName] + + if !isInstalled { + filteredPackages = append(filteredPackages, pkg) + continue + } + + repoVer := pkg.Version + releaseStr := overrides.ReleasePlatformSpecific(pkg.Release, osRelease) + + if pkg.Release != 0 && pkg.Epoch == 0 { + repoVer = fmt.Sprintf("%s-%s", pkg.Version, releaseStr) + } else if pkg.Release != 0 && pkg.Epoch != 0 { + repoVer = fmt.Sprintf("%d:%s-%s", pkg.Epoch, pkg.Version, releaseStr) + } + + cmp := vercmp.Compare(repoVer, installedVer) + + if cmp > 0 { + slog.Info(gotext.Get("Package %s is installed with older version %s, will rebuild with version %s", alrPkgName, installedVer, repoVer)) + filteredPackages = append(filteredPackages, pkg) + } else if cmp == 0 { + slog.Info(gotext.Get("Package %s is already installed with version %s, skipping build", alrPkgName, installedVer)) + } else { + slog.Info(gotext.Get("Package %s is installed with newer version %s (repo has %s), skipping build", alrPkgName, installedVer, repoVer)) + } + } + + return filteredPackages, nil +} diff --git a/internal/build/plugins_executors.go b/internal/build/plugins_executors.go index 98d388e..0ddad49 100644 --- a/internal/build/plugins_executors.go +++ b/internal/build/plugins_executors.go @@ -21,6 +21,7 @@ import ( "gitea.plemya-x.ru/Plemya-x/ALR/internal/manager" "gitea.plemya-x.ru/Plemya-x/ALR/pkg/alrsh" + "gitea.plemya-x.ru/Plemya-x/ALR/pkg/distro" "gitea.plemya-x.ru/Plemya-x/ALR/pkg/types" ) @@ -34,6 +35,7 @@ type InstallerExecutor interface { Install(ctx context.Context, pkgs []string, opts *manager.Opts) error Remove(ctx context.Context, pkgs []string, opts *manager.Opts) error RemoveAlreadyInstalled(ctx context.Context, pkgs []string) ([]string, error) + FilterPackagesByVersion(ctx context.Context, packages []alrsh.Package, osRelease *distro.OSRelease) ([]alrsh.Package, error) } type ScriptExecutor interface { diff --git a/internal/build/plugins_executors_gen.go b/internal/build/plugins_executors_gen.go index b7e3417..49bf3f4 100644 --- a/internal/build/plugins_executors_gen.go +++ b/internal/build/plugins_executors_gen.go @@ -24,6 +24,7 @@ import ( "context" "gitea.plemya-x.ru/Plemya-x/ALR/internal/manager" "gitea.plemya-x.ru/Plemya-x/ALR/pkg/alrsh" + "gitea.plemya-x.ru/Plemya-x/ALR/pkg/distro" "gitea.plemya-x.ru/Plemya-x/ALR/pkg/types" "github.com/hashicorp/go-plugin" ) @@ -205,6 +206,38 @@ func (s *InstallerExecutorRPCServer) RemoveAlreadyInstalled(args *InstallerExecu return nil } +type InstallerExecutorFilterPackagesByVersionArgs struct { + Packages []alrsh.Package + OsRelease *distro.OSRelease +} + +type InstallerExecutorFilterPackagesByVersionResp struct { + Result0 []alrsh.Package +} + +func (s *InstallerExecutorRPC) FilterPackagesByVersion(ctx context.Context, packages []alrsh.Package, osRelease *distro.OSRelease) ([]alrsh.Package, error) { + var resp *InstallerExecutorFilterPackagesByVersionResp + err := s.client.Call("Plugin.FilterPackagesByVersion", &InstallerExecutorFilterPackagesByVersionArgs{ + Packages: packages, + OsRelease: osRelease, + }, &resp) + if err != nil { + return nil, err + } + return resp.Result0, nil +} + +func (s *InstallerExecutorRPCServer) FilterPackagesByVersion(args *InstallerExecutorFilterPackagesByVersionArgs, resp *InstallerExecutorFilterPackagesByVersionResp) error { + result0, err := s.Impl.FilterPackagesByVersion(context.Background(), args.Packages, args.OsRelease) + if err != nil { + return err + } + *resp = InstallerExecutorFilterPackagesByVersionResp{ + Result0: result0, + } + return nil +} + type ScriptExecutorReadScriptArgs struct { ScriptPath string } diff --git a/internal/build/script_executor.go b/internal/build/script_executor.go index 1bd1b11..77573c1 100644 --- a/internal/build/script_executor.go +++ b/internal/build/script_executor.go @@ -167,30 +167,30 @@ func (e *LocalScriptExecutor) ExecuteSecondPass( pkgName := packager.ConventionalFileName(pkgInfo) // Получаем имя файла пакета pkgPath := filepath.Join(dirs.BaseDir, pkgName) // Определяем путь к пакету - slog.Info("Creating package file", "path", pkgPath, "name", pkgName) + slog.Info(gotext.Get("Creating package file"), "path", pkgPath, "name", pkgName) pkgFile, err := os.Create(pkgPath) if err != nil { - slog.Error("Failed to create package file", "path", pkgPath, "error", err) + slog.Error(gotext.Get("Failed to create package file"), "path", pkgPath, "error", err) return nil, err } defer pkgFile.Close() - slog.Info("Packaging with nfpm", "format", pkgFormat) + slog.Info(gotext.Get("Packaging with nfpm"), "format", pkgFormat) err = packager.Package(pkgInfo, pkgFile) if err != nil { - slog.Error("Failed to create package", "path", pkgPath, "error", err) + slog.Error(gotext.Get("Failed to create package"), "path", pkgPath, "error", err) return nil, err } - slog.Info("Package created successfully", "path", pkgPath) + slog.Info(gotext.Get("Package created successfully"), "path", pkgPath) // Проверяем, что файл действительно существует if _, err := os.Stat(pkgPath); err != nil { - slog.Error("Package file not found after creation", "path", pkgPath, "error", err) + slog.Error(gotext.Get("Package file not found after creation"), "path", pkgPath, "error", err) return nil, err } - slog.Info("Package file verified to exist", "path", pkgPath) + slog.Info(gotext.Get("Package file verified to exist"), "path", pkgPath) builtDeps = append(builtDeps, &BuiltDep{ Name: vars.Name, diff --git a/internal/cliutils/app_builder/builder.go b/internal/cliutils/app_builder/builder.go index a946a12..116f8ad 100644 --- a/internal/cliutils/app_builder/builder.go +++ b/internal/cliutils/app_builder/builder.go @@ -42,7 +42,7 @@ type AppDeps struct { func (d *AppDeps) Defer() { if d.DB != nil { if err := d.DB.Close(); err != nil { - slog.Warn("failed to close db", "err", err) + slog.Warn(gotext.Get("failed to close db"), "err", err) } } } diff --git a/internal/cliutils/template.go b/internal/cliutils/template.go index 131fb29..c53812d 100644 --- a/internal/cliutils/template.go +++ b/internal/cliutils/template.go @@ -100,3 +100,28 @@ func GetCommandHelpTemplate() string { gotext.Get("OPTIONS"), ) } + +func GetSubcommandHelpTemplate() string { + return fmt.Sprintf(`%s: + {{template "helpNameTemplate" .}} + +%s: + {{.HelpName}} %s [%s] {{if .ArgsUsage}}{{.ArgsUsage}}{{else}}[%s...]{{end}} +{{if .Description}} + +%s: + {{template "descriptionTemplate" .}}{{end}} +{{- if len .Authors}} + +%s{{template "authorsTemplate" .}}{{end}}{{if .VisibleCommands}} + +%s:{{template "visibleCommandCategoryTemplate" .}}{{end}}{{if .VisibleFlagCategories}} + +%s:{{template "visibleFlagCategoryTemplate" .}}{{else if .VisibleFlags}} + +%s:{{template "visibleFlagTemplate" .}}{{end}}{{if .Copyright}} + +%s: + {{template "copyrightTemplate" .}}{{end}} +`, gotext.Get("NAME"), gotext.Get("USAGE"), gotext.Get("command"), gotext.Get("command options"), gotext.Get("arguments"), gotext.Get("DESCRIPTION"), gotext.Get("AUTHOR"), gotext.Get("COMMANDS"), gotext.Get("OPTIONS"), gotext.Get("OPTIONS"), gotext.Get("COPYRIGHT")) +} diff --git a/internal/repos/pull.go b/internal/repos/pull.go index f0da904..c39ad51 100644 --- a/internal/repos/pull.go +++ b/internal/repos/pull.go @@ -36,7 +36,7 @@ import ( "github.com/go-git/go-git/v5/plumbing" "github.com/leonelquinteros/gotext" "github.com/pelletier/go-toml/v2" - "go.elara.ws/vercmp" + "gitea.plemya-x.ru/xpamych/vercmp" "mvdan.cc/sh/v3/expand" "mvdan.cc/sh/v3/interp" "mvdan.cc/sh/v3/syntax" @@ -420,13 +420,13 @@ func (rs *Repos) processRepoChanges(ctx context.Context, repo types.Repo, r *git case actionDelete: scriptFl, err := oldCommit.File(action.File) if err != nil { - slog.Warn("Failed to get deleted file from old commit", "file", action.File, "error", err) + slog.Warn(gotext.Get("Failed to get deleted file from old commit"), "file", action.File, "error", err) continue } r, err := scriptFl.Reader() if err != nil { - slog.Warn("Failed to read deleted file", "file", action.File, "error", err) + slog.Warn(gotext.Get("Failed to read deleted file"), "file", action.File, "error", err) continue } @@ -445,13 +445,13 @@ func (rs *Repos) processRepoChanges(ctx context.Context, repo types.Repo, r *git case actionUpdate: scriptFl, err := newCommit.File(action.File) if err != nil { - slog.Warn("Failed to get updated file from new commit", "file", action.File, "error", err) + slog.Warn(gotext.Get("Failed to get updated file from new commit"), "file", action.File, "error", err) continue } r, err := scriptFl.Reader() if err != nil { - slog.Warn("Failed to read updated file", "file", action.File, "error", err) + slog.Warn(gotext.Get("Failed to read updated file"), "file", action.File, "error", err) continue } @@ -505,7 +505,7 @@ func (rs *Repos) processRepoFull(ctx context.Context, repo types.Repo, repoDir s } if len(matches) == 0 { - slog.Warn("No alr.sh files found in repository", "repo", repo.Name) + slog.Warn(gotext.Get("No alr.sh files found in repository"), "repo", repo.Name) return nil } diff --git a/internal/translations/po/ru/default.po b/internal/translations/po/ru/default.po index 8935dbf..9372669 100644 --- a/internal/translations/po/ru/default.po +++ b/internal/translations/po/ru/default.po @@ -341,7 +341,7 @@ msgstr "Выберите, какой пакет использовать для #: internal/cliutils/prompt.go:156 msgid "Choose which optional package(s) to install" -msgstr "Выберите, какой дополнительный пакет(ы) следует установить" +msgstr "Выберите дополнительные пакеты для установки" #: internal/cliutils/template.go:74 internal/cliutils/template.go:93 msgid "NAME" @@ -501,10 +501,14 @@ msgstr "Аргументы, которые будут переданы мене msgid "Enable interactive questions and prompts" msgstr "Включение интерактивных вопросов и запросов" -#: main.go:148 +#: main.go:147 msgid "Show help" msgstr "Показать справку" +#: main.go:148 +msgid "Shows a list of commands or help for one command" +msgstr "Показывает список команд или справку по одной команде" + #: main.go:152 msgid "Error while running app" msgstr "Ошибка при запуске приложения" @@ -551,7 +555,7 @@ msgstr "<имя>" #: repo.go:103 repo.go:465 repo.go:568 msgid "Repo \"%s\" does not exist" -msgstr "Репозитория \"%s\" не существует" +msgstr "Репозиторий \"%s\" не существует" #: repo.go:110 msgid "Error removing repo directory" @@ -620,7 +624,7 @@ msgstr "URL \"%s\" не существует в репозитории \"%s\"" #: repo.go:508 repo.go:580 msgid "Removed %d mirrors from repo \"%s\"\n" -msgstr "Удалены зеркала %d из репозитория \"%s\"\n" +msgstr "Удалено %d зеркал из репозитория \"%s\"\n" #: repo.go:520 msgid "Remove all mirrors from the repository" @@ -636,7 +640,7 @@ msgstr "URL-адрес нового репозитория" #: repo.go:632 msgid "Name of the repo to be deleted" -msgstr "Название репозитория удалён" +msgstr "Название репозитория для удаления" #: search.go:40 msgid "Search packages" @@ -656,7 +660,7 @@ msgstr "Искать по репозиторию" #: search.go:66 msgid "Search by provides" -msgstr "Иcкать по provides" +msgstr "Искать по provides" #: search.go:130 msgid "Error while executing search" @@ -672,7 +676,107 @@ msgstr "Ошибка при проверке обновлений" #: upgrade.go:126 msgid "There is nothing to do." -msgstr "Здесь нечего делать." +msgstr "Действия не требуются." + +#: internal/build/installer.go:88 +msgid "Package %s is installed with older version %s, will rebuild with version %s" +msgstr "Пакет %s установлен с устаревшей версией %s, будет пересобран с версией %s" + +#: internal/build/installer.go:96 +msgid "Package %s is already installed with version %s, skipping build" +msgstr "Пакет %s уже установлен с версией %s, пропуск сборки" + +#: internal/build/installer.go:102 +msgid "Package %s is installed with newer version %s (repo has %s), skipping build" +msgstr "Пакет %s установлен с более новой версией %s (в репозитории %s), пропуск сборки" + +#: internal/build/script_executor.go:170 +msgid "Creating package file" +msgstr "Создание файла пакета" + +#: internal/build/script_executor.go:174 +msgid "Failed to create package file" +msgstr "Не удалось создать файл пакета" + +#: internal/build/script_executor.go:179 +msgid "Packaging with nfpm" +msgstr "Упаковка с помощью nfpm" + +#: internal/build/script_executor.go:182 +msgid "Failed to create package" +msgstr "Не удалось создать пакет" + +#: internal/build/script_executor.go:186 +msgid "Package created successfully" +msgstr "Пакет успешно создан" + +#: internal/build/script_executor.go:190 +msgid "Package file not found after creation" +msgstr "Файл пакета не найден после создания" + +#: internal/build/script_executor.go:193 +msgid "Package file verified to exist" +msgstr "Наличие файла пакета подтверждено" + +#: internal/repos/pull.go:423 +msgid "Failed to get deleted file from old commit" +msgstr "Не удалось получить удалённый файл из старого коммита" + +#: internal/repos/pull.go:429 +msgid "Failed to read deleted file" +msgstr "Не удалось прочитать удалённый файл" + +#: internal/repos/pull.go:448 +msgid "Failed to get updated file from new commit" +msgstr "Не удалось получить обновлённый файл из нового коммита" + +#: internal/repos/pull.go:454 +msgid "Failed to read updated file" +msgstr "Не удалось прочитать обновлённый файл" + +#: internal/repos/pull.go:508 +msgid "No alr.sh files found in repository" +msgstr "Файлы alr.sh не найдены в репозитории" + +#: internal/cliutils/app_builder/builder.go:45 +msgid "failed to close db" +msgstr "не удалось закрыть БД" + +#: internal/build/build.go:342 +msgid "Using cached package" +msgstr "Используется кешированный пакет" + +#: upgrade.go:89 +msgid "Updating system packages..." +msgstr "Обновление системных пакетов..." + +#: upgrade.go:97 +msgid "System packages updated successfully" +msgstr "Системные пакеты успешно обновлены" + +#: build.go:203 +msgid "Package file already moved or removed, skipping" +msgstr "Файл пакета уже перемещён или удалён, пропускаем" + +#: fix.go:75 +msgid "Clearing cache and temporary directories" +msgstr "Очистка кэша и временных директорий" + +#: fix.go:119 +msgid "Clearing temporary directory" +msgstr "Очистка временной директории" + +#: fix.go:126 +msgid "Unable to remove temporary directory as current user, trying with sudo" +msgstr "Невозможно удалить временную директорию от текущего пользователя, попытка через sudo" + +#: fix.go:156 +msgid "Fixing permissions on temporary files" +msgstr "Исправление прав доступа к временным файлам" + +#: fix.go:177 +msgid "Creating cache directory" +msgstr "Создание директории кэша" #, fuzzy #~ msgid "Failed to clear contents of cache directory" diff --git a/main.go b/main.go index c7d5763..ad3ca66 100644 --- a/main.go +++ b/main.go @@ -50,6 +50,22 @@ func VersionCmd() *cli.Command { } } +func HelpCmd() *cli.Command { + return &cli.Command{ + Name: "help", + Aliases: []string{"h"}, + Usage: gotext.Get("Shows a list of commands or help for one command"), + ArgsUsage: "[command]", + Action: func(cCtx *cli.Context) error { + args := cCtx.Args() + if args.Present() { + return cli.ShowCommandHelp(cCtx, args.First()) + } + return cli.ShowAppHelp(cCtx) + }, + } +} + func GetApp() *cli.App { return &cli.App{ Name: "alr", @@ -88,6 +104,7 @@ func GetApp() *cli.App { InternalBuildCmd(), InternalInstallCmd(), InternalReposCmd(), + HelpCmd(), }, Before: func(c *cli.Context) error { if trimmed := strings.TrimSpace(c.String("pm-args")); trimmed != "" { @@ -144,6 +161,7 @@ func main() { // Make the application more internationalized cli.AppHelpTemplate = cliutils.GetAppCliTemplate() cli.CommandHelpTemplate = cliutils.GetCommandHelpTemplate() + cli.SubcommandHelpTemplate = cliutils.GetSubcommandHelpTemplate() cli.HelpFlag.(*cli.BoolFlag).Usage = gotext.Get("Show help") err = app.RunContext(ctx, os.Args) diff --git a/repo.go b/repo.go index 5e6a178..11ae393 100644 --- a/repo.go +++ b/repo.go @@ -46,6 +46,24 @@ func RepoCmd() *cli.Command { SetRepoRefCmd(), RepoMirrorCmd(), SetUrlCmd(), + RepoHelpCmd(), + }, + } +} + +func RepoHelpCmd() *cli.Command { + return &cli.Command{ + Name: "help", + Aliases: []string{"h"}, + Usage: gotext.Get("Shows a list of commands or help for one command"), + ArgsUsage: "[command]", + Action: func(cCtx *cli.Context) error { + args := cCtx.Args() + if args.Present() { + return cli.ShowCommandHelp(cCtx, args.First()) + } + cli.ShowSubcommandHelp(cCtx) + return nil }, } } @@ -331,6 +349,24 @@ func RepoMirrorCmd() *cli.Command { AddMirror(), RemoveMirror(), ClearMirrors(), + MirrorHelpCmd(), + }, + } +} + +func MirrorHelpCmd() *cli.Command { + return &cli.Command{ + Name: "help", + Aliases: []string{"h"}, + Usage: gotext.Get("Shows a list of commands or help for one command"), + ArgsUsage: "[command]", + Action: func(cCtx *cli.Context) error { + args := cCtx.Args() + if args.Present() { + return cli.ShowCommandHelp(cCtx, args.First()) + } + cli.ShowSubcommandHelp(cCtx) + return nil }, } } diff --git a/upgrade.go b/upgrade.go index ec84a5b..c242479 100644 --- a/upgrade.go +++ b/upgrade.go @@ -26,7 +26,7 @@ import ( "github.com/leonelquinteros/gotext" "github.com/urfave/cli/v2" - "go.elara.ws/vercmp" + "gitea.plemya-x.ru/xpamych/vercmp" "golang.org/x/exp/maps" "gitea.plemya-x.ru/Plemya-x/ALR/internal/build"