Skip to content

Commit

Permalink
feat[close #106]: Prevent pkg apply to apply changes if already applied
Browse files Browse the repository at this point in the history
  • Loading branch information
mirkobrombin committed May 5, 2024
1 parent fcc4db1 commit 87e0bc2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions cmd/pkg.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,17 @@ func pkg(cmd *cobra.Command, args []string) error {
cmdr.Info.Printf(abroot.Trans("pkg.listMsg"), added, removed)
return nil
case "apply":
unstaged, err := pkgM.GetUnstagedPackages()
if err != nil {
cmdr.Error.Println(err)
return err
}

if len(unstaged) == 0 {
cmdr.Info.Println(abroot.Trans("pkg.noChanges"))
return nil
}

aBsys, err := core.NewABSystem()
if err != nil {
cmdr.Error.Println(err)
Expand Down
1 change: 1 addition & 0 deletions locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ pkg:
applyFailed: "Apply command failed: %s\n"
removedMsg: "Package(s) %s removed.\n"
listMsg: "Added packages:\n%s\nRemoved packages:\n%s\n"
noChanges: "No changes to apply."
dryRunFlag: "perform a dry run of the operation"
forceEnableUserAgreementFlag: "force enable user agreement, for embedded systems"
agreementMsg: "To utilize ABRoot's abroot pkg command, explicit user agreement is required. This command facilitates package installations but introduces non-deterministic elements, impacting system trustworthiness. By consenting, you acknowledge and accept these implications, confirming your awareness of the command's potential impact on system behavior. [y/N]: "
Expand Down

0 comments on commit 87e0bc2

Please sign in to comment.