Commit Graph

29 Commits

Author SHA1 Message Date
Brad Fitzpatrick f483cba421 cmdmain, cmd/pk: support for demoting prominence of some subcommands
We saw users get confused about the flood of help out of useless
commands like dbinit.

Change-Id: I627bd4f0e79abfcf2274626112d31c965c43396a
2018-05-02 13:48:04 -07:00
mpl 7a27eb42eb cmd: rename camget to pk-get, and make it a mode of pk
A couple of related fixes and renames too.

Updates #981
Fixes #1056

Change-Id: Id47a933c77422edfb9db41d34c38ed9d0d7a1846
2018-04-22 20:50:54 -07:00
mpl 2bb666ccf6 all: rename remaining occurrences of camput
Also removed misc/buildbot while at it (which contained camput
references) since we don't use it anymore at all.

TODO: the OSX app seems to be relying on finding a binary in ../bin,
which we do not use anymore. This will probably need fixing.

Updates #981

Change-Id: I14220fbad2e81181330fca4bb2d2e5fe170e1bd6
2018-04-21 16:20:24 -07:00
mpl ce4658abfc cmd: rename camput to pk-put, and make "pk put" call it
A new "put" mode is added to the pk command, so that the "pk put"
command can be used to create and upload blobs.

What this command does is actually just call the previously named
"camput" executable, which is renamed to "pk-put" in this change.

This involves adding a new way to register a mode in cmdmain, when such
a mode is just meant to call an external binary. To emphasize the
distinction, the existing func (to register a sub-command, or a mode) is
renamed from RegisterCommand to RegisterMode, and RegisterCommand is now
the name of the new func/way.

Updates #981
Updates #1056

Change-Id: Ief954c17aa88a376f551df7de4b4e9fe41ad96d1
2018-04-21 10:26:55 -07:00
mpl 6dcbe2ee9c cmd/camtool: rename from camtool to pk
Updates #981
Updates #1056

Change-Id: Ib78c47a69fa9816d5ac6cc547586a2af321005e3
2018-03-06 16:20:59 +01:00
Paul Lindner 459c75410e all: more renaming of Camlistore to Perkeep
Change-Id: I118e3cbcf20d80afeffc84f001388c4556f21628
2018-01-30 03:02:56 -08:00
Adam Shannon 02fc19475c cmdmain: sort Modes and Examples
Fixes #1002

Change-Id: Icd8d2727dbdd73e85a05450278eb9f25f4a49121
2018-01-03 21:55:01 -06:00
Brad Fitzpatrick d6a0b05df0 Rename import paths from camlistore.org to perkeep.org.
Part of the project renaming, issue #981.

After this, users will need to mv their $GOPATH/src/camlistore.org to
$GOPATH/src/perkeep.org. Sorry.

This doesn't yet rename the tools like camlistored, camput, camget,
camtool, etc.

Also, this only moves the lru package to internal. More will move to
internal later.

Also, this doesn't yet remove the "/pkg/" directory. That'll likely
happen later.

This updates some docs, but not all.

devcam test now passes again, even with Go 1.10 (which requires vet
checks are clean too). So a bunch of vet tests are fixed in this CL
too, and a bunch of other broken tests are now fixed (introduced from
the past week of merging the CL backlog).

Change-Id: If580db1691b5b99f8ed6195070789b1f44877dd4
2018-01-01 16:03:34 -08:00
mpl 960d5fd76e pkg/cmdmain: set flag.CommandLine output to Stderr
Otherwise the calls to flag.PrintDefaults would print to os.Stderr
instead of cmdmain.Stderr.

Change-Id: Iaad0884b5d583ff808e8129671d274601aa401cb
2017-11-20 21:14:27 +01:00
mpl a6a3cac0df cmd/*: always output on fatal errors
This CL addresses issues #685 and #862.

The general problem is that some critical errors, that lead clients such
as camput to exit with failure, are not displayed when not running in
verbose mode.

The reason that happens is because of code such as:

	if *cmdmain.FlagVerbose {
		log.SetOutput(cmdmain.Stderr)
	} else {
		log.SetOutput(ioutil.Discard)
	}

which means that in non-verbose mode we discard absolutely all log
messages, even those that would be printed during a Fatal* call.

To address that problem, we introduce a logger, as well as the Printf
and Logf functions using it, in pkg/cmdmain. These two functions only
output when *cmdmain.FlagVerbose is true.

Commands such as camput or camtool should now always:
1) log.SetOutput(cmdmain.Stderr) in init().
2) use log.Printf for messages that should always be printed.
3) use cmdmain.Printf/Logf for messages that should only be printed when
*cmdmain.FlagVerbose is true.
4) use log.Fatal for critical errors.
5) optionally, set the Verbose and Logger of the client(s) they are
using.

Also, camput and camtool are now relying on the global -verbose flag
from cmdmain, instead of having to define one for each subcommand.

fixes #685
fixes #862

Change-Id: I088032fd28184a201076097bf878894b22a8a120
2017-10-19 02:22:44 +02:00
Stephen Searles 2a08eafcab print mode information on top-level commands with just -h
Previously commands like camput, when invoked with simply just -h or
--help, they would only print the global flags defined on
flag.CommandLine of the standard library. In order to reach the richer
help text including mode information, you had to specify some mode, even
a fake one.

This change just replaces the flag.Usage function so that the global
help flag handling will call into the code that prints the nicer
message.

Fixes #890

Change-Id: Ib9ae73472148de6e92eeba92f12b5af7debe2bd1
2016-12-08 22:31:59 -08:00
Tamás Gulácsi 7402cc0efd Delete misc unused objects
Using honnef.co/go/unused/cmd/unused

Change-Id: I672b3cb77f09e9bd80dcdc149cde4f7f2939e451
2016-04-06 17:59:51 +02:00
Will Norris 77ed42edf8 add canonical import paths
The import path was added to the go file that included the package
documentation if one existed.  Otherwise, I used what seemed to be the
primary file for the package.

Fixes #689

Change-Id: If51be0e86529fd6f179e80af6781e639f8550fd2
2016-03-13 19:57:14 -07:00
mpl cea5e332ce vendor: go4.org/legal
At rev c3c16077b235db4c6b2a2a6121c2d429707f4ed4

And use it in new package pkg/camlegal

And remove pkg/legal

Change-Id: I5e398aa5f145a02a04d33719276fd2f8b82ab12b
2015-12-16 18:50:49 +01:00
mpl 3db00e5e98 devcam: move modtime check after cwd check
checkCamliSrcRoot was meant to give a nice error msg if devcam is
invoked from outside the Camlistore source tree. However, it was never
called because the modtime check (checkModtime), which itself needs to
be run from that same location, was called first. So we were always
getting the terse "open dev/devcam: no such file or directory" error
message instead.

Fixes #589

Change-Id: I13a1bb3819217ffbaf727fa6154f077dd8babd49
2015-05-07 16:53:44 +02:00
mpl 250664d8eb camput: use Errorf to print critical errors even when non-verbose
http://camlistore.org/issue/524

Change-Id: Ied24471288ea459785291281afa7316a257b6884
2014-11-03 22:15:36 +01:00
Piotr S. Staszewski 5e61e2d84e legal: package for compiled-in licenses
Initial implementation, printing helper and 'wiring' for cam* tools.

Change-Id: Icf8baa77ee1f12495be8f1a57b7d575d6918cb5c
2014-07-10 23:01:54 +02:00
mpl 4569a7f475 devcam review: submit changes for review
Context: http://camlistore.org/issue/408

Change-Id: I587de65c9dc8d87c02541096e1f4f7765e644962
2014-05-13 23:06:30 +02:00
Brad Fitzpatrick 593e0f0f81 cmdmain, camput: PreExit should always run, not just in verbose mode
Change-Id: I6001a3474071a00f0ab56b031ac8c5504e5e9da5
2014-02-27 20:47:15 -08:00
Brad Fitzpatrick 85e2e5e301 Fix crash with "go test -v -cpu=1,1 ./cmd/camput/"
Don't double-register the help flag. Only affects tests run twice, like above.

Change-Id: Ia235f2e2aa4a70e3b5a5c6fe21d8add90069664f
2014-02-21 10:59:34 -08:00
Brad Fitzpatrick 16219f24b0 cmdmain: set flagset output to cmdmain.Stderr
Default flag output only goes to cmdmain.Stderr when >= Go 1.2

Change-Id: Id2358b4c22b76901ceb834695d54e32f7c2d7013
2014-02-18 18:41:51 -08:00
Brad Fitzpatrick f99eaf5e36 cmdmain: guard ExtraFlagRegistration with a Once
Change-Id: Id54111dc21eeb61b02721117123b956fcc3b47fd
2014-02-18 00:31:10 -08:00
Brad Fitzpatrick f4bbeb3549 cmdmain: remove spurious newlines from commands with no examples
Change-Id: I0cae9dd4a822fb94e3ecdff7dc257bd3804fdd04
2014-02-09 15:41:52 -08:00
Brad Fitzpatrick cf0d9aca6e More docs
Change-Id: I5c21f240c85bcf91fb67487cc172bf3faeb49fff
2013-07-07 18:52:14 -07:00
mpl b5e75e9207 cmdmain: use ExitWithFailure, exit on error instead of returning it
Change-Id: I553bed110394cb8ab48b331ba74d551b840ada5c
2013-02-27 22:04:50 +01:00
mpl 81cb48980e camtool: added dbinit.
Change-Id: I26c58023a5275612dfd2bf85adfd59e8c08baab5
2013-02-27 16:07:02 +01:00
mpl 3a21c89712 camput: fix test. Add descriptions for better help.
Change-Id: I9016fca1dcf36ca5908947e84a5251bf587a83a7
2013-02-26 21:08:24 +01:00
mpl d1a909ea5e camtool: added gsinit, was cmd/camgsinit. Better help too.
Change-Id: Icefe51759db8b89b51f408a66a3d10f2148d7137
2013-02-26 14:45:49 +01:00
mpl 59d0d6cb7e Create camtool cmd, with sync subcommand.
Code in common with camput was factorized in pkg/cmdmain/
Partly addresses
http://code.google.com/p/camlistore/issues/detail?id=117

Change-Id: Iabebea7ea78e56bdb8a6eccee9456c52bfe9cceb
2013-02-20 23:47:17 +01:00