Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
git-backup
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Alain Takoudjou
git-backup
Commits
b4dd16c6
Commit
b4dd16c6
authored
Dec 13, 2016
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
countFlag moved to lab.nexedi.com/kirr/go123/xflag
to xflag.Count
parent
48b3ab43
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
45 deletions
+3
-45
git-backup.go
git-backup.go
+3
-2
misc.go
misc.go
+0
-43
No files found.
git-backup.go
View file @
b4dd16c6
...
...
@@ -79,6 +79,7 @@ import (
"lab.nexedi.com/kirr/go123/mem"
"lab.nexedi.com/kirr/go123/myname"
"lab.nexedi.com/kirr/go123/xerr"
"lab.nexedi.com/kirr/go123/xflag"
"lab.nexedi.com/kirr/go123/xstrings"
git
"github.com/libgit2/git2go"
...
...
@@ -961,8 +962,8 @@ func usage() {
func
main
()
{
flag
.
Usage
=
usage
quiet
:=
0
flag
.
Var
((
*
countFlag
)(
&
verbose
),
"v"
,
"verbosity level"
)
flag
.
Var
((
*
countFlag
)(
&
quiet
),
"q"
,
"decrease verbosity"
)
flag
.
Var
((
*
xflag
.
Count
)(
&
verbose
),
"v"
,
"verbosity level"
)
flag
.
Var
((
*
xflag
.
Count
)(
&
quiet
),
"q"
,
"decrease verbosity"
)
flag
.
IntVar
(
&
njobs
,
"j"
,
njobs
,
"allow max N jobs to spawn"
)
flag
.
Parse
()
verbose
-=
quiet
...
...
misc.go
deleted
100644 → 0
View file @
48b3ab43
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file (in go.git repository).
package
main
import
(
"flag"
"fmt"
"strconv"
)
// flag that is both bool and int - for e.g. handling -v -v -v ...
// inspired/copied by/from cmd.dist.count in go.git
type
countFlag
int
func
(
c
*
countFlag
)
String
()
string
{
return
fmt
.
Sprint
(
int
(
*
c
))
}
func
(
c
*
countFlag
)
Set
(
s
string
)
error
{
switch
s
{
case
"true"
:
*
c
++
case
"false"
:
*
c
=
0
default
:
n
,
err
:=
strconv
.
Atoi
(
s
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"invalid count %q"
,
s
)
}
*
c
=
countFlag
(
n
)
}
return
nil
}
// flag.boolFlag
func
(
c
*
countFlag
)
IsBoolFlag
()
bool
{
return
true
}
// flag.Value
var
_
flag
.
Value
=
(
*
countFlag
)(
nil
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment