Skip to content

Commit

Permalink
Merge pull request #151 from WillAbides/syncsums
Browse files Browse the repository at this point in the history
add checksums sync
  • Loading branch information
WillAbides authored May 29, 2023
2 parents e728f61 + cbda987 commit 5aa9fbe
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 3 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,8 @@ Commands:
supported-system remove remove a supported system
checksums add add checksums to the config file
checksums prune remove unnecessary checksums from the config file
checksums sync add checksums to the config file and remove unnecessary
checksums
init create an empty config file
cache clear clear the cache
version show bindown version
Expand Down
19 changes: 19 additions & 0 deletions cmd/bindown/checksums.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
type checksumsCmd struct {
Add addChecksumsCmd `kong:"cmd,help=${add_checksums_help}"`
Prune pruneChecksumsCmd `kong:"cmd,help=${prune_checksums_help}"`
Sync syncChecksumsCmd `kong:"cmd,help=${sync_checksums_help}"`
}

type addChecksumsCmd struct {
Expand Down Expand Up @@ -39,3 +40,21 @@ func (d *pruneChecksumsCmd) Run(ctx *runContext) error {
}
return config.WriteFile(ctx.rootCmd.JSONConfig)
}

type syncChecksumsCmd struct{}

func (d *syncChecksumsCmd) Run(ctx *runContext) error {
config, err := loadConfigFile(ctx, true)
if err != nil {
return err
}
err = config.PruneChecksums()
if err != nil {
return err
}
err = config.AddChecksums(nil, nil)
if err != nil {
return err
}
return config.WriteFile(ctx.rootCmd.JSONConfig)
}
1 change: 1 addition & 0 deletions cmd/bindown/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ var kongVars = kong.Vars{
"systems_help": `target systems in the format of <os>/<architecture>`,
"add_checksums_help": `add checksums to the config file`,
"prune_checksums_help": `remove unnecessary checksums from the config file`,
"sync_checksums_help": `add checksums to the config file and remove unnecessary checksums`,
"config_format_help": `formats the config file`,
"config_validate_help": `validate that installs work`,
"config_install_completions_help": `install shell completions`,
Expand Down
2 changes: 2 additions & 0 deletions docs/clihelp.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ Commands:
supported-system remove remove a supported system
checksums add add checksums to the config file
checksums prune remove unnecessary checksums from the config file
checksums sync add checksums to the config file and remove unnecessary
checksums
init create an empty config file
cache clear clear the cache
version show bindown version
Expand Down
10 changes: 7 additions & 3 deletions script/release
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,17 @@ else
fi
fi

# pre-build so there isn't such a long time between creating the release and adding the assets
if [ -f ".goreleaser.yaml" ]; then
script/bindown -q install goreleaser
bin/goreleaser release --snapshot --clean
fi

bin/gh release create "v$NEXT_VERSION" -t "v$NEXT_VERSION" --generate-notes

# If there's no .goreleaser.yaml, there's nothing left to do.
[ -f ".goreleaser.yaml" ] || exit 0

# now build for real
git fetch --tags

script/bindown -q install goreleaser

bin/goreleaser release --clean

0 comments on commit 5aa9fbe

Please sign in to comment.