Skip to content

Commit

Permalink
feat: add --version switch
Browse files Browse the repository at this point in the history
  • Loading branch information
wowu committed Jul 21, 2022
1 parent 5646736 commit f848908
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 3 deletions.
32 changes: 32 additions & 0 deletions bin/bump_version
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash
set -e

if [ -z "$1" ]; then
echo "Usage: $0 <version>"
exit 1
fi

# check if git is clean
if ! git diff-index --quiet HEAD --; then
echo "Please commit your changes before bumping the version"
exit 1
fi

echo "Last version: $(git describe --abbrev=0 --tags)"
echo "New version: $1"

read -p "This command will replace version strings and create a commit. Proceed? (y/n) " -n 1 -r; echo
[ "$REPLY" != "y" ] && exit 1

gsed -i -E "s/(Version: +)\".+\"/\1\"$1\"/" pro.go
git add pro.go
echo pro.go Done

git commit -m "Bump version to $1"

read -p "Do you want to tag the commit? (y/n) " -n 1 -r; echo
if [ "$REPLY" = "y" ]; then
git tag "$1"
fi

git show
7 changes: 4 additions & 3 deletions pro.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ func main() {
// cli library API example:
// https://github.com/urfave/cli/blob/main/docs/v2/manual.md#full-api-example
app := &cli.App{
Name: "pro",
Usage: "Pull Request Opener",
Flags: openCommandFlags,
Name: "pro",
Usage: "Pull Request Opener",
Version: "v0.1.4",
Flags: openCommandFlags,
Commands: []*cli.Command{
{
Name: "auth",
Expand Down

0 comments on commit f848908

Please sign in to comment.