-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
if neither --log nor --plot is passed nothing happens, by default log to stdout #50
Comments
to get psrecord to print to the console what i want/need, i wrote a simple 30 line shell script:
i would prefer the default behavior would be to print to console the same thing that is output to the log file --> then i could get rid of my 30 line shell script. |
I agree that printing out to stdout would make sense by default and would be happy to review a PR enabling this! |
@astrofrog wrote:
Done! Note that I implemented it as explained above: if neither It would be trivial to make stdout the default argument for |
If neither --log nor --plot is passed, log to stdout. Closes #50
Hi,
this both a bug report and a proposal.
From reading the code what I get is that if neither
--log LOG
nor--plot PLOT
is passedpsrecord
still work, but no data gets printed, saved or plotted anywhere.Is this behavior intended?
I cannot imagine why this should not raise an error saying
"You need to specify at least one between --log LOG and --plot PLOT"
. In my opinion, one sensible default would be writing to standard output, i.e. like ifpsrecord
was called like this:In this way
--log
and--plot
are truly options, and their usage reflects the usage string ofpsrecord
.Instead, if you want to make either one of the two options mandatory it's a little bit more tricky. Unfortunately
argparse
is not able to handle this use case, that is having two options of whom at least one is required (also, they are not mutually exclusive).One simple way would be to add a check like this:
With
docopt
- well, POSIX - this would be represented like this:The text was updated successfully, but these errors were encountered: