From 964fcb6224228f0c28ab1a1ed197bc799a66147e Mon Sep 17 00:00:00 2001 From: Futrime Date: Fri, 17 Feb 2023 17:44:43 +0800 Subject: [PATCH] feat: add -y flag --- CHANGELOG.md | 7 +++++-- src/main.go | 9 ++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6022081..107db8c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,12 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.2.0] - 2023-02-17 +### Added +- `-y` flag to skip confirmation ## [0.1.0] - 2023-02-09 - ### Added - Basic functionality -[unreleased]: https://github.com/LiteLDev/Lip/compare/v0.1.0...HEAD +[unreleased]: https://github.com/LiteLDev/Lip/compare/v0.2.0...HEAD +[0.2.0]: https://github.com/LiteLDev/Lip/compare/v0.1.0...v0.2.0 [0.1.0]: https://github.com/LiteLDev/Lip/releases/tag/v0.1.0 \ No newline at end of file diff --git a/src/main.go b/src/main.go index 1a0551e..fc31f52 100644 --- a/src/main.go +++ b/src/main.go @@ -24,8 +24,10 @@ func main() { fmt.Println("- Microsoft Privacy Policy https://go.microsoft.com/fwlink/?LinkId=521839") usePreview := false + skipAgree := false flagSet := flag.NewFlagSet("bdsdown", flag.ExitOnError) flagSet.BoolVar(&usePreview, "preview", false, "Use preview version") + flagSet.BoolVar(&skipAgree, "y", false, "Skip the agreement") flagSet.Usage = func() { fmt.Println("Usage: bdsdown [options] [version]") fmt.Println("Options:") @@ -40,7 +42,12 @@ func main() { fmt.Print("Please enter y if you agree with the above terms: ") var agree string - fmt.Scanln(&agree) + if skipAgree { + agree = "y" + fmt.Println(agree) + } else { + fmt.Scanln(&agree) + } if agree != "y" { fmt.Println(ColorYellow + "You must agree with the above terms to use this software." + ColorReset) return