Open felipecrs opened 3 years ago
Thanks for sharing this requirement @felipecrs. I think that the rt-fs jfrog-cli plugin can do what you're looking for. It includes a cat command which prints the content of file to the stdout. Please let us know if this helps.
Thank you so much for the suggestion. It indeed does what I propose, except that for my very own use case it does not:
❯ jfrog rt-fs cat 'repo/project/latest/project-*.json'
[Error] Wildcards are not supported in paths.
exit status 1
@felipecrs, I'm not sure if curl supports this, but if it does, you can use the jfrog rt curl command, which uses the connection details configured using the jfrog c add command.
The jfrog rt curl
is very nice, thanks for letting me know. As with curl
itself, it also supports outputting to stdout
. However it does not seem to support wildcards as jfrog rt download
does.
❯ jfrog rt curl 'repo/project/latest/project-*.json'
{
"errors" : [ {
"status" : 404,
"message" : "File not found."
} ]
}
Ok, I found a way to do it without having to handle files:
jfrog rt search --fail-no-op --limit 1 'repo/project/latest/project-*.json' | jq -er '.[0].path' | xargs jfrog rt curl
Caveats:
jq
jfrog
twiceWouldn't
jfrog rt download --flat=true 'repo/project/latest/project-*.json' /dev/stdout | jq -er .version
work? (at least on unix-like systems)
Problem
When I have to download a metadata file, such as JSON or XML with JFrog, I have to manipulate files because the
jfrog rt download
can't download tostdout
.Solution
Notice the
-
used as target output. This often meansstdout
in other CLIs, would be good if it could be supported here as well. Example of another program which supports it:Important: any other text, such as progress, results summary, etc, must be redirected to the
stderr
instead ofstdout
to assure thestdout
will only contain the contents of the file (as is withwget
).Alternatives
I have to do something like:
Instead of: