Only print "Reading from /dev/stdin" message when we actually read from
stdin (and not in other cases such as ipfs add --help).
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
* Resolve symlink if it is directly referenced in cli
test: Directly referenced symlink should be resolved
License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
* sharness: add test for symlink in the middle
License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
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>
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>
For the rest of the packages in util, move them to thirdparty
and update the references. util is gone!
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
This changes the pin behavior. It uses the filenames given through
the api, and allows files to be streamed faltly (not a hierarchy),
which is easier for other things (like vinyl in node-ipfs-api land).
Files can also be entirely out of order, and the garbage intermediate
directories will not be pinned (gc-ed later).
The changes also mean the output of add has changed slightly-- it
no longer shows the local path added, but rather the dag path
relative to the added roots. This is a small difference, but changes
tests.
The dagutils.Editor creates a lot of chaff (intermediate objects)
along the way. Wonder how we might minimize the writes to the
datastore...
This commit also removes the "NilRepo()" part of the --only-hash
mode. We need to store at least in an in-mem repo/datastore because
otherwise the dagutils.Editor breaks.
License: MIT
Signed-off-by: Juan Batiz-Benet <juan@benet.ai>
There can be non-terminal (i.e. non-interactive) sessions
that are *not* a pipe, for example:
ssh user@host ipfs version
In this case, it looks like we should read from stdin.
Parsing stdin is accomplished by deliberately triggering
the parsing loop once.
We didn't previously check whether there is an ArgDef to support
that loop iteration.
This should fix issue #1196 (Can't launch a command line
process from Qt).
The check was bad because it took stdin into account,
but it really shouldn't.
License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
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>