Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
098dbccd
Commit
098dbccd
authored
Apr 21, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
af34e00a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
17 deletions
+19
-17
t/neo/zodb/cmd/zodb/zodb.go
t/neo/zodb/cmd/zodb/zodb.go
+15
-13
t/neo/zodb/zodbtools/dump.go
t/neo/zodb/zodbtools/dump.go
+2
-2
t/neo/zodb/zodbtools/info.go
t/neo/zodb/zodbtools/info.go
+2
-2
No files found.
t/neo/zodb/cmd/zodb/zodb.go
View file @
098dbccd
...
@@ -19,17 +19,14 @@
...
@@ -19,17 +19,14 @@
package
main
package
main
import
(
import
(
"flag"
"fmt"
"os"
"../../zodbtools"
"../../zodbtools"
)
)
var
commandv
=
[]
Command
{
// TODO analyze ?
// TODO cmp
{
"dump"
,
zodbtools
.
DumpMain
},
{
"info"
,
zodbtools
.
InfoMain
},
}
func
usage
()
{
func
usage
()
{
w
:=
os
.
Stderr
w
:=
os
.
Stderr
fmt
.
Fprintf
(
w
,
fmt
.
Fprintf
(
w
,
...
@@ -40,10 +37,11 @@ Usage:
...
@@ -40,10 +37,11 @@ Usage:
zodb command [arguments]
zodb command [arguments]
The commands are:
The commands are:
`
)
`
)
// TODO print commands
// TODO print commands
for
_
,
cmd
:=
range
zodbtools
.
AllCommands
()
{
for
_
,
cmd
:=
range
zodbtools
.
AllCommands
()
{
fmt
.
Fprintf
(
w
,
"
\t
%
s
\t
%s
\n
"
,
cmd
.
Name
,
cmd
.
Summary
)
fmt
.
Fprintf
(
w
,
"
\t
%
-11s
%s
\n
"
,
cmd
.
Name
,
cmd
.
Summary
)
}
}
fmt
.
Fprintf
(
w
,
fmt
.
Fprintf
(
w
,
...
@@ -74,12 +72,16 @@ func help(argv []string) {
...
@@ -74,12 +72,16 @@ func help(argv []string) {
topic
:=
argv
[
1
]
topic
:=
argv
[
1
]
// topic can either be a command name or a help topic
// topic can either be a command name or a help topic
command
->
usage
(
os
.
Stdout
)
command
:=
zodbtools
.
LookupCommand
(
topic
)
if
command
!=
nil
{
command
.
Usage
(
os
.
Stdout
)
os
.
Exit
(
0
)
}
// TODO topic
// TODO topic
fmt
.
Fprintf
(
os
.
Stderr
,
"Unknown help topic `%s`. Run 'zodb help'."
,
topic
)
fmt
.
Fprintf
(
os
.
Stderr
,
"Unknown help topic `%s`. Run 'zodb help'.
\n
"
,
topic
)
os
.
Exit
(
2
)
os
.
Exit
(
2
)
}
}
...
@@ -93,7 +95,7 @@ func main() {
...
@@ -93,7 +95,7 @@ func main() {
os
.
Exit
(
2
)
os
.
Exit
(
2
)
}
}
command
=
argv
[
0
]
command
:
=
argv
[
0
]
// help on a topic
// help on a topic
if
command
==
"help"
{
if
command
==
"help"
{
...
@@ -102,8 +104,8 @@ func main() {
...
@@ -102,8 +104,8 @@ func main() {
}
}
// run subcommand
// run subcommand
cmd
,
ok
:=
commandDir
[
command
]
cmd
:=
zodbtools
.
LookupCommand
(
command
)
if
!
ok
{
if
cmd
==
nil
{
fmt
.
Fprintf
(
os
.
Stderr
,
"zodb: unknown subcommand
\"
%s
\"
"
,
command
)
fmt
.
Fprintf
(
os
.
Stderr
,
"zodb: unknown subcommand
\"
%s
\"
"
,
command
)
fmt
.
Fprintf
(
os
.
Stderr
,
"Run 'zodb help' for usage."
)
fmt
.
Fprintf
(
os
.
Stderr
,
"Run 'zodb help' for usage."
)
os
.
Exit
(
2
)
os
.
Exit
(
2
)
...
...
t/neo/zodb/zodbtools/dump.go
View file @
098dbccd
...
@@ -222,12 +222,12 @@ Options:
...
@@ -222,12 +222,12 @@ Options:
func
dumpMain
(
argv
[]
string
)
{
func
dumpMain
(
argv
[]
string
)
{
hashOnly
:=
false
hashOnly
:=
false
tidRange
:=
".."
//
(0, +inf)
tidRange
:=
".."
//
[0, +inf]
flags
:=
flag
.
FlagSet
{
Usage
:
func
()
{
dumpUsage
(
os
.
Stderr
)
}}
flags
:=
flag
.
FlagSet
{
Usage
:
func
()
{
dumpUsage
(
os
.
Stderr
)
}}
flags
.
Init
(
""
,
flag
.
ExitOnError
)
flags
.
Init
(
""
,
flag
.
ExitOnError
)
flags
.
BoolVar
(
&
hashOnly
,
"hashonly"
,
hashOnly
,
"dump only hashes of objects"
)
flags
.
BoolVar
(
&
hashOnly
,
"hashonly"
,
hashOnly
,
"dump only hashes of objects"
)
flags
.
Parse
(
argv
)
flags
.
Parse
(
argv
[
1
:
]
)
argv
=
flags
.
Args
()
argv
=
flags
.
Args
()
if
len
(
argv
)
<
1
{
if
len
(
argv
)
<
1
{
...
...
t/neo/zodb/zodbtools/info.go
View file @
098dbccd
...
@@ -40,7 +40,7 @@ var infov = []struct {name string; getParam paramFunc} {
...
@@ -40,7 +40,7 @@ var infov = []struct {name string; getParam paramFunc} {
}
}
// {} parameter_name -> get_parameter(stor)
// {} parameter_name -> get_parameter(stor)
var
infoDict
map
[
string
]
paramFunc
var
infoDict
=
map
[
string
]
paramFunc
{}
func
init
()
{
func
init
()
{
for
_
,
info
:=
range
infov
{
for
_
,
info
:=
range
infov
{
...
@@ -103,7 +103,7 @@ Options:
...
@@ -103,7 +103,7 @@ Options:
func
infoMain
(
argv
[]
string
)
{
func
infoMain
(
argv
[]
string
)
{
flags
:=
flag
.
FlagSet
{
Usage
:
func
()
{
infoUsage
(
os
.
Stderr
)
}}
flags
:=
flag
.
FlagSet
{
Usage
:
func
()
{
infoUsage
(
os
.
Stderr
)
}}
flags
.
Init
(
""
,
flag
.
ExitOnError
)
flags
.
Init
(
""
,
flag
.
ExitOnError
)
flags
.
Parse
(
argv
)
flags
.
Parse
(
argv
[
1
:
]
)
argv
=
flags
.
Args
()
argv
=
flags
.
Args
()
if
len
(
argv
)
<
1
{
if
len
(
argv
)
<
1
{
...
...
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