Skip to content

Commit

Permalink
feat: Bump Orchid to v0.6.0, usage localization
Browse files Browse the repository at this point in the history
  • Loading branch information
matbme authored Jun 17, 2024
1 parent cf2f245 commit a579af3
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 7 deletions.
3 changes: 2 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ func New(version string, fs embed.FS) *cmdr.App {
abroot = cmdr.NewApp("abroot", version, fs)
return abroot
}

func NewRootCommand(version string) *cmdr.Command {
root := cmdr.NewCommand(
abroot.Trans("abroot.use"),
Expand All @@ -38,7 +39,7 @@ func NewRootCommand(version string) *cmdr.Command {
WithPersistentBoolFlag(
cmdr.NewBoolFlag(
verboseFlag,
"v",
"V",
abroot.Trans("abroot.verboseFlag"),
false))
root.Version = version
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/vanilla-os/abroot

go 1.21.4
go 1.22

require (
github.com/containers/buildah v1.35.1
Expand All @@ -15,7 +15,7 @@ require (
github.com/spf13/cobra v1.8.0
github.com/spf13/viper v1.18.2
github.com/vanilla-os/differ/diff v0.0.0-20240202135932-673de99cc540
github.com/vanilla-os/orchid v0.5.0
github.com/vanilla-os/orchid v0.6.0
github.com/vanilla-os/prometheus v1.0.0
github.com/vanilla-os/sdk v0.0.0-20240424182549-7fbf2ce02046
golang.org/x/sys v0.18.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,8 @@ github.com/vanilla-os/differ/diff v0.0.0-20240202135932-673de99cc540 h1:KrNjRudM
github.com/vanilla-os/differ/diff v0.0.0-20240202135932-673de99cc540/go.mod h1:HMg24arXCutcwngVaJ4DQuhwLmS8CA/CuVSjEyIxFpw=
github.com/vanilla-os/orchid v0.5.0 h1:QAOjJ2VcyND5TxK0XYUEu+dysxXicRHhV6i/07S47mk=
github.com/vanilla-os/orchid v0.5.0/go.mod h1:dNPvHxofO4hEXodEKXp0nLQDZhoHh8evCUXc6X1xLao=
github.com/vanilla-os/orchid v0.6.0 h1:aH7i621QrqtbspGUie4To28zCk1u1UvGHGzL11wdldE=
github.com/vanilla-os/orchid v0.6.0/go.mod h1:dNPvHxofO4hEXodEKXp0nLQDZhoHh8evCUXc6X1xLao=
github.com/vanilla-os/prometheus v1.0.0 h1:je+vWK9Ir1SzCIz2yoSE3tFmGKli4Q1z/LQ5mNk/+Pc=
github.com/vanilla-os/prometheus v1.0.0/go.mod h1:CPWeG0LJW4gHcLHSkqx9jANi5574a03R3ihWNy4PIig=
github.com/vanilla-os/sdk v0.0.0-20240424182549-7fbf2ce02046 h1:FYVQ7Suwq2O7D7Nm1XiWcy78M5z2PHd/HZJYFBiJ9HM=
Expand Down
12 changes: 12 additions & 0 deletions locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ abroot:
short: "ABRoot provides full immutability and atomicity by performing transactions
between 2 root partitions (A<->B)"
verboseFlag: "show more detailed output"
msg:
help: "Show help for abroot."
version: "Show version for abroot."
usage: "Usage"
aliases: "Aliases"
examples: "Examples"
availableCommands: "Available Commands"
additionalCommands: "Additional Commands"
flags: "Flags"
globalFlags: "Global Flags"
additionalHelpTopics: "Additional help topics"
moreInfo: "Use %s for more information about a command"

kargs:
use: "kargs"
Expand Down
19 changes: 15 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ import (
"github.com/vanilla-os/orchid/cmdr"
)

var (
Version = "2.0.1"
)
var Version = "2.0.1"

//go:embed locales/*.yml
var fs embed.FS
Expand All @@ -39,7 +37,20 @@ func main() {

// root command
root := cmd.NewRootCommand(Version)
abroot.CreateRootCommand(root)
abroot.CreateRootCommand(root, abroot.Trans("abroot.msg.help"), abroot.Trans("abroot.msg.version"))

msgs := cmdr.UsageStrings{
Usage: abroot.Trans("abroot.msg.usage"),
Aliases: abroot.Trans("abroot.msg.aliases"),
Examples: abroot.Trans("abroot.msg.examples"),
AvailableCommands: abroot.Trans("abroot.msg.availableCommands"),
AdditionalCommands: abroot.Trans("abroot.msg.additionalCommands"),
Flags: abroot.Trans("abroot.msg.flags"),
GlobalFlags: abroot.Trans("abroot.msg.globalFlags"),
AdditionalHelpTopics: abroot.Trans("abroot.msg.additionalHelpTopics"),
MoreInfo: abroot.Trans("abroot.msg.moreInfo"),
}
abroot.SetUsageStrings(msgs)

upgrade := cmd.NewUpgradeCommand()
root.AddCommand(upgrade)
Expand Down

0 comments on commit a579af3

Please sign in to comment.