1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-08-06 03:19:47 +08:00

42 Commits

Author SHA1 Message Date
ddc8d0c60c commands: remove EnableStdin support for StringArg
With verbose flag:
* remove EnableStdin() flags on all StringArg,

* remove all unneeded parsing code for StringArg, and print an
* informative message if `ipfs` begins reading from a CharDevice,

* remove broken go tests for EnableStdin cli parsing, and add some
* trivial test cases for reading FileArg from stdin,

* add a panic to prevent EnableStdin from being set on
* StringArg in the future.

Resolves: #2877, #2870
License: MIT
Signed-off-by: Thomas Gardner <tmg@fastmail.com>
2016-06-26 12:28:55 +10:00
7279153a0c commands/cli: Add a test for 3e8244
License: MIT
Signed-off-by: Thomas Gardner <tmg@fastmail.com>
2016-04-16 12:22:17 +10:00
3e824412d9 commands/cli: fix parsing of incorrect permutations
parseOpts now does some preliminary path screening to prevent
command sequences like

	`ipfs <hash> cat`

from succeeding. The tests affected by this have been slightly altered,
but should be restored once parseOpts is decoupled from path analysis.

Command suggestion printing has also been factored into a single
function.

Fixes: #2501
License: MIT
Signed-off-by: Thomas Gardner <tmg@fastmail.com>
2016-04-05 21:53:21 +10:00
dbf0185a91 fix panic in cli arg parsing
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2016-02-17 13:05:51 -08:00
44059875b6 skip cli parse tests on windows due to no stdin
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-10-28 14:23:17 -07:00
a8fc65fda0 Added tests from code-review
License: MIT
Signed-off-by: ForrestWeston <Forrest.Weston@gmail.com>
2015-10-13 17:11:05 -07:00
107409cee8 Added ability to specify true/false for bool opts
License: MIT
Signed-off-by: ForrestWeston <Forrest.Weston@gmail.com>
2015-10-13 17:11:05 -07:00
23681727e0 parse: fix parsing optional arg with stdin
License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2015-05-21 00:30:08 +02:00
be3b7e13e3 parse_test: test command with optional arg
License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2015-05-20 22:47:14 +02:00
4e0ca860e9 parse_test: test unwanted stdin 2015-05-20 04:23:43 +02:00
c561c0980b Merge pull request #1239 from rht/master
Add gofmt check
2015-05-19 04:03:23 -04:00
rht
ac7edddb94 Run 'gofmt -s -w' on these files 2015-05-19 06:11:15 +07:00
275ec7c2a0 parse_test: test stdin enabled and not variadic arg
License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2015-05-18 00:24:13 +02:00
c93d583f02 parse_test: add tests with 2 args and stdin
License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2015-05-17 23:48:56 +02:00
5503c4cc89 parse_test: improve error messages
License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2015-05-17 23:14:08 +02:00
97ab64af30 parse: don't use stdin if there are arguments
This should fix issue #1141 (ipfs cat "multihash too short"
error when using stdin) and perhaps others.

License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2015-05-17 21:19:12 +02:00
ff9cb9ecf4 parse_test: test multiline stdin
License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2015-05-17 20:34:40 +02:00
93f253e00b parse_test: add testFail() to simplify tests
License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2015-05-03 20:18:40 +02:00
47a88f8429 parse_test: improve existing tests
License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2015-05-03 20:10:28 +02:00
c6dcfaaf5d parse_test: use fileToSimulateStdin()
License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2015-05-03 12:09:13 +02:00
58126c1c6c parse_test: improve tests with stdin enabled arg
Now also check that we get the right arguments from
the parsing.

License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2015-05-02 23:35:24 +02:00
d0752a714d parse_test: add tests for stdin enabled arg
Let's document how stdin enabled arguments currently
work by adding some tests.

License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2015-05-02 23:02:57 +02:00
3e4a06945f parse_test: fix and test sameWords()
License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2015-05-02 23:02:57 +02:00
2a5b2f2f4a parse_test: move helper functions
License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2015-05-02 23:02:57 +02:00
f168539030 Improve command line parsing 2015-04-27 17:19:38 +00:00
bf22aeec0a Reorged imports from jbenet/go-ipfs to ipfs/go-ipfs
- Modified Godeps/Godeps.json by hand
- [TEST] Updated welcome docs hash to sharness
- [TEST] Updated contact doc
- [TEST] disabled breaking test (t0080-repo refs local)
2015-03-31 12:52:25 -07:00
922f84878c commands/cli: Added argument parse tests 2014-11-19 18:30:06 -08:00
ae6f00d766 commands: Fixed tests 2014-11-19 00:36:42 -08:00
6302356e15 commands: Fixed tests 2014-11-04 02:04:46 -08:00
184c25430b go-vet friendly codebase
- distinguish log.Error and log.Errorf functions
- Initialize structs with field names
- A bit of unreachable code (defers)
2014-10-25 03:46:39 -07:00
dd81bf630f commands: Fixed tests 2014-10-21 18:07:49 -07:00
4986600e54 parsePath no err 2014-10-20 08:00:28 -07:00
7673ce6f65 fmt, lint, + vet commands/ 2014-10-20 07:53:14 -07:00
a9fa767b09 commands/cli: Added test for detecting duplicate options 2014-10-20 07:04:55 -07:00
b48b12e425 commands/cli: Fixed test for new parsing 2014-10-20 07:04:55 -07:00
86bc450b20 commands/cli: Pass option definitions as an argument to parseOptions 2014-10-20 07:04:53 -07:00
97b8719075 commands/cli: Removed parser string handling since the go runtime handles it for us automatically 2014-10-20 07:04:53 -07:00
5d9fa93c85 commands/cli: Added test for single-dash option value 2014-10-20 07:04:53 -07:00
08885c0ced commands/cli: Fixed tests for refactor 2014-10-20 07:04:52 -07:00
66b0727de6 commands/cli: Renamed parse functions to parse* 2014-10-20 07:04:52 -07:00
f437230d88 commands/cli: Added path/args test 2014-10-20 07:04:52 -07:00
b3eecf4f64 commands/cli: Added simple option parser test 2014-10-20 07:04:52 -07:00