Closed CristianCantoro closed 4 months ago
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:
I agree that printing out to stdout would make sense by default and would be happy to review a PR enabling this!
Done!
Note that I implemented it as explained above: if neither --log
nor --plot
is passed then psrecord will print to stdfout.
However, if you pass --plot
, it won't print anything to stdout. This means that strictly speaking, this behavior is not a default for a missing --log
.
It would be trivial to make stdout the default argument for --log
and independent from --plot
, which may be a more sensible choice.
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: