Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat[close #106]: Prevent pkg apply to apply changes if already applied #279

Merged
merged 1 commit into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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