Skip to content

Commit

Permalink
Remove the --quiet and --legacy options
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Oct 26, 2023
1 parent f69839f commit 806f476
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 18 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG
Expand Up @@ -4,7 +4,9 @@ CHANGELOG
* 2.0.0 (2023-XX-XX)

* move to go.mod
* deprecate the `--quiet` option (append `2>/dev/null` to the command instead)
* remove the `--quiet` option (append `2>/dev/null` to the command instead)
* remove the `--legacy` option (same as `--git '<1.8.2'`)

* move information console display to stderr instead of stdout

* 1.0.1 (2017-02-24)
Expand Down
21 changes: 4 additions & 17 deletions main.go
Expand Up @@ -42,7 +42,7 @@ func (p *prefixesFlag) Set(value string) error {

var prefixes prefixesFlag
var origin, target, commit, path, gitVersion string
var scratch, debug, quiet, legacy, progress, v bool
var scratch, debug, progress, v bool

func init() {
flag.Var(&prefixes, "prefix", "The directory(ies) to split")
Expand All @@ -52,8 +52,6 @@ func init() {
flag.StringVar(&path, "path", ".", "The repository path (optional, current directory by default)")
flag.BoolVar(&scratch, "scratch", false, "Flush the cache (optional)")
flag.BoolVar(&debug, "debug", false, "Enable the debug mode (optional)")
flag.BoolVar(&quiet, "quiet", false, "[DEPRECATED] Suppress the output (optional)")
flag.BoolVar(&legacy, "legacy", false, "[DEPRECATED] Enable the legacy mode for projects migrating from an old version of git subtree split (optional)")
flag.StringVar(&gitVersion, "git", "latest", "Simulate a given version of Git (optional)")
flag.BoolVar(&progress, "progress", false, "Show progress bar (optional, cannot be enabled when debug is enabled)")
flag.BoolVar(&v, "version", false, "Show version")
Expand All @@ -72,30 +70,21 @@ func main() {
os.Exit(1)
}

if legacy {
fmt.Fprintln(os.Stderr, `The --legacy option is deprecated (use --git="<1.8.2" instead)`)
gitVersion = "<1.8.2"
}

if quiet {
fmt.Fprintln(os.Stderr, `The --quiet option is deprecated (append 2>/dev/null to the command instead)`)
}

config := &splitter.Config{
Path: path,
Origin: origin,
Prefixes: []*splitter.Prefix(prefixes),
Target: target,
Commit: commit,
Debug: debug && !quiet,
Debug: debug,
Scratch: scratch,
GitVersion: gitVersion,
}

result := &splitter.Result{}

var ticker *time.Ticker
if progress && !debug && !quiet {
if progress && !debug {
ticker = time.NewTicker(time.Millisecond * 50)
go func() {
for range ticker.C {
Expand All @@ -113,9 +102,7 @@ func main() {
ticker.Stop()
}

if !quiet {
fmt.Fprintf(os.Stderr, "%d commits created, %d commits traversed, in %s\n", result.Created(), result.Traversed(), result.Duration(time.Millisecond))
}
fmt.Fprintf(os.Stderr, "%d commits created, %d commits traversed, in %s\n", result.Created(), result.Traversed(), result.Duration(time.Millisecond))

if result.Head() != nil {
fmt.Println(result.Head().String())
Expand Down

0 comments on commit 806f476

Please sign in to comment.