Compare commits
No commits in common. "master" and "fix/migrate-to-new-progressbar" have entirely different histories.
master
...
fix/migrat
22
build.go
22
build.go
@ -61,27 +61,19 @@ func BuildCmd() *cli.Command {
|
|||||||
ctx := c.Context
|
ctx := c.Context
|
||||||
|
|
||||||
var script string
|
var script string
|
||||||
|
|
||||||
// Проверяем, установлен ли флаг script (-s)
|
|
||||||
if c.IsSet("script") {
|
|
||||||
script = c.String("script")
|
|
||||||
} else if c.IsSet("package") {
|
|
||||||
// Если флаг script не установлен, проверяем флаг package (-p)
|
|
||||||
packageInput := c.String("package")
|
packageInput := c.String("package")
|
||||||
// Определяем, содержит ли packageInput символ '/'
|
|
||||||
|
if packageInput != "" {
|
||||||
|
// If the package input contains a '/', use it as the full path.
|
||||||
if filepath.Dir(packageInput) == "." {
|
if filepath.Dir(packageInput) == "." {
|
||||||
// Не указана директория репозитория, используем 'default' как префикс
|
// No directory specified, use 'default' as a prefix.
|
||||||
script = filepath.Join(config.GetPaths(ctx).RepoDir, "default", packageInput, "alr.sh")
|
script = filepath.Join(config.GetPaths(ctx).RepoDir, "default", packageInput, "alr.sh")
|
||||||
} else {
|
} else {
|
||||||
// Используем путь с указанным репозиторием
|
// Use the full path specified by the user.
|
||||||
script = filepath.Join(config.GetPaths(ctx).RepoDir, packageInput, "alr.sh")
|
script = filepath.Join(config.GetPaths(ctx).RepoDir, packageInput, "alr.sh")
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
// Ни флаги script, ни package не установлены, используем дефолтный скрипт
|
|
||||||
script = filepath.Join(config.GetPaths(ctx).RepoDir, "alr.sh")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Проверка автоматического пулла репозиториев
|
|
||||||
if config.GetInstance(ctx).AutoPull(ctx) {
|
if config.GetInstance(ctx).AutoPull(ctx) {
|
||||||
err := repos.Pull(ctx, config.Config(ctx).Repos)
|
err := repos.Pull(ctx, config.Config(ctx).Repos)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -90,14 +82,12 @@ func BuildCmd() *cli.Command {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Обнаружение менеджера пакетов
|
|
||||||
mgr := manager.Detect()
|
mgr := manager.Detect()
|
||||||
if mgr == nil {
|
if mgr == nil {
|
||||||
slog.Error(gotext.Get("Unable to detect a supported package manager on the system"))
|
slog.Error(gotext.Get("Unable to detect a supported package manager on the system"))
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Сборка пакета
|
|
||||||
pkgPaths, _, err := build.BuildPackage(ctx, types.BuildOpts{
|
pkgPaths, _, err := build.BuildPackage(ctx, types.BuildOpts{
|
||||||
Script: script,
|
Script: script,
|
||||||
Manager: mgr,
|
Manager: mgr,
|
||||||
@ -109,14 +99,12 @@ func BuildCmd() *cli.Command {
|
|||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Получение текущей рабочей директории
|
|
||||||
wd, err := os.Getwd()
|
wd, err := os.Getwd()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
slog.Error(gotext.Get("Error getting working directory"), "err", err)
|
slog.Error(gotext.Get("Error getting working directory"), "err", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Перемещение собранных пакетов в рабочую директорию
|
|
||||||
for _, pkgPath := range pkgPaths {
|
for _, pkgPath := range pkgPaths {
|
||||||
name := filepath.Base(pkgPath)
|
name := filepath.Base(pkgPath)
|
||||||
err = osutils.Move(pkgPath, filepath.Join(wd, name))
|
err = osutils.Move(pkgPath, filepath.Join(wd, name))
|
||||||
|
1
go.mod
1
go.mod
@ -73,7 +73,6 @@ require (
|
|||||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
||||||
github.com/golang/snappy v0.0.4 // indirect
|
github.com/golang/snappy v0.0.4 // indirect
|
||||||
github.com/google/rpmpack v0.6.1-0.20240329070804-c2247cbb881a // indirect
|
github.com/google/rpmpack v0.6.1-0.20240329070804-c2247cbb881a // indirect
|
||||||
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
|
|
||||||
github.com/google/uuid v1.4.0 // indirect
|
github.com/google/uuid v1.4.0 // indirect
|
||||||
github.com/goreleaser/chglog v0.6.1 // indirect
|
github.com/goreleaser/chglog v0.6.1 // indirect
|
||||||
github.com/goreleaser/fileglob v1.3.0 // indirect
|
github.com/goreleaser/fileglob v1.3.0 // indirect
|
||||||
|
2
go.sum
2
go.sum
@ -196,8 +196,6 @@ github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26/go.mod h1:dDKJzRmX4S3
|
|||||||
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
|
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
|
||||||
github.com/google/rpmpack v0.6.1-0.20240329070804-c2247cbb881a h1:JJBdjSfqSy3mnDT0940ASQFghwcZ4y4cb6ttjAoXqwE=
|
github.com/google/rpmpack v0.6.1-0.20240329070804-c2247cbb881a h1:JJBdjSfqSy3mnDT0940ASQFghwcZ4y4cb6ttjAoXqwE=
|
||||||
github.com/google/rpmpack v0.6.1-0.20240329070804-c2247cbb881a/go.mod h1:uqVAUVQLq8UY2hCDfmJ/+rtO3aw7qyhc90rCVEabEfI=
|
github.com/google/rpmpack v0.6.1-0.20240329070804-c2247cbb881a/go.mod h1:uqVAUVQLq8UY2hCDfmJ/+rtO3aw7qyhc90rCVEabEfI=
|
||||||
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4=
|
|
||||||
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ=
|
|
||||||
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4=
|
github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4=
|
||||||
github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
|
@ -68,7 +68,6 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|||||||
m.remaining = time.Duration(msg.remaining) * time.Second
|
m.remaining = time.Duration(msg.remaining) * time.Second
|
||||||
if m.percent >= 1.0 {
|
if m.percent >= 1.0 {
|
||||||
m.done = true
|
m.done = true
|
||||||
return m, tea.Quit
|
|
||||||
}
|
}
|
||||||
return m, nil
|
return m, nil
|
||||||
case tea.WindowSizeMsg:
|
case tea.WindowSizeMsg:
|
||||||
|
@ -251,11 +251,11 @@ msgstr ""
|
|||||||
msgid "Downloading source"
|
msgid "Downloading source"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: internal/dl/progress_tui.go:100
|
#: internal/dl/progress_tui.go:99
|
||||||
msgid "%s: done!\n"
|
msgid "%s: done!\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: internal/dl/progress_tui.go:104
|
#: internal/dl/progress_tui.go:103
|
||||||
msgid "%s %s downloading at %s/s\n"
|
msgid "%s %s downloading at %s/s\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -263,11 +263,11 @@ msgstr "Источник обновлён и связан с пунктом на
|
|||||||
msgid "Downloading source"
|
msgid "Downloading source"
|
||||||
msgstr "Скачивание источника"
|
msgstr "Скачивание источника"
|
||||||
|
|
||||||
#: internal/dl/progress_tui.go:100
|
#: internal/dl/progress_tui.go:99
|
||||||
msgid "%s: done!\n"
|
msgid "%s: done!\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: internal/dl/progress_tui.go:104
|
#: internal/dl/progress_tui.go:103
|
||||||
msgid "%s %s downloading at %s/s\n"
|
msgid "%s %s downloading at %s/s\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -36,7 +36,6 @@ import (
|
|||||||
|
|
||||||
// Импортируем пакеты для поддержки различных форматов пакетов (APK, DEB, RPM и ARCH).
|
// Импортируем пакеты для поддержки различных форматов пакетов (APK, DEB, RPM и ARCH).
|
||||||
|
|
||||||
"github.com/google/shlex"
|
|
||||||
_ "github.com/goreleaser/nfpm/v2/apk"
|
_ "github.com/goreleaser/nfpm/v2/apk"
|
||||||
_ "github.com/goreleaser/nfpm/v2/arch"
|
_ "github.com/goreleaser/nfpm/v2/arch"
|
||||||
_ "github.com/goreleaser/nfpm/v2/deb"
|
_ "github.com/goreleaser/nfpm/v2/deb"
|
||||||
@ -44,6 +43,7 @@ import (
|
|||||||
"github.com/leonelquinteros/gotext"
|
"github.com/leonelquinteros/gotext"
|
||||||
"mvdan.cc/sh/v3/expand"
|
"mvdan.cc/sh/v3/expand"
|
||||||
"mvdan.cc/sh/v3/interp"
|
"mvdan.cc/sh/v3/interp"
|
||||||
|
"mvdan.cc/sh/v3/shell"
|
||||||
"mvdan.cc/sh/v3/syntax"
|
"mvdan.cc/sh/v3/syntax"
|
||||||
|
|
||||||
"github.com/goreleaser/nfpm/v2"
|
"github.com/goreleaser/nfpm/v2"
|
||||||
@ -537,7 +537,7 @@ func executeFunctions(ctx context.Context, dec *decoder.Decoder, dirs types.Dire
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
contents, err := shlex.Split(buf.String())
|
contents, err := shell.Fields(buf.String(), func(s string) string { return "" })
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user