-
Notifications
You must be signed in to change notification settings - Fork 49
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
Added command-line options --ask and --save (and --version) #15
base: master
Are you sure you want to change the base?
Conversation
Option --ask asks for a positive 'y' or 'yes' response before uploading. Option --save skips uploading entirely and saves locally. As this adds several new options, the entire option-parsing process was rewritten to use OptionParser. For completeness, support for --version was added as well. This change also moved the version number out of the .gemspec, into "lib/showterm/version.rb".
It would be nice to have the option of both uploading and saving (for backup purposes). Is there an easy way to download the recorded session from the generated showterm.io link? |
@poulson Such an option would be only a minor change to my patch. There's several ways that could work, though. Currently, my On the other hand, it would be trivial to wrap that up in another option. What would be the "least surprising" behavior, though: should This brings up the question, too, of if it should be possible to name your save file. [and another concern about the generated files themselves, but that's another feature entirely that I'll discuss in another ticket (#19)] While I'm not sure it's needed (or desired?), here's a possible larger set of options for discussion:
Opinions? Additions/Modifications? I'd be happy to add these kind of changes, if needed. I'm fine leaving it as-is, too. |
@pdkl95 I don't have strong feelings about some of your questions, but I noticed this. I think it's a big mistake for something like Maybe the easiest way to handle this would be to add an (optional?) parameter to |
(>_<) I have no idea why I missed the exit code. You're entirely correct, of course. I'm fixing it now. Adding an arg for the exit code is easy, but... now that I'm doing it, I think I'll also split this into separate functions. That way |
refactored #die_politely tow functions - #die_politely for the traditional error cases that call #exit, and a new #save_politely that only does the save w/ message. cleaned up a few of the nearby print statements for clarity.
I would propose, if no command-line arguments are given, for two questions to be asked: "save a local copy?" and "upload?". It would be nice for all four combinations to be possible. There are also many usecases where one might want to go back and download a copy from the website (for example, perhaps someone else uploaded it). |
I'd would vote against the last proposal. Normal Unix-like rules are "no arguments at all" -> show help menu or just start. Which happens depends on the application. "Chatty" applications that ask for too many responses are generally less useful, since they don't work as well in pipes or scripts. Just my two cents. |
@pdkl95 Hey, nice patch! What's the --save argument for? (I don't really see the use-case, and it seems like a confusing choice for a user to have to make and a pretty bad implementation, saving files into /tmp is basically the same as not saving them). @poulson I want typing That said, I would like to implement downloading (shouldn't be too hard, but it might be worth switching from a two-file to a one-file format first, see #19) and deleting. |
@telemachus @ConradIrwin I agree with your point, but I honestly don't care whether or not the configuration is exposed via prompts or via command-line options. The point is that it would be nice to be able to handle all four combinations of saving/not-saving and uploading/not-uploading. |
@telemachus I agree that the unix tradition of "silent on success, noisy on error" is something to maintain when possible, and the other use cases can easily be handled by options. The possible exception to this I could see (note: not actually recommending this!) is, given the auto-upload feature might be unexpected for someone trying it for the first time, a warning that is shown on the first run might be useful. Such a warning is probably overkill in this case, where the uploading was kind of the whole point. @ConradIrwin The I'll see if I can upload my branched version I've been poking at later, if I can finish a couple things, that both includes a possibility for the single-file idea in #19, and has a larger rework of the command-line options. That might serve as a useful reference for discussion. |
Option --ask asks for a positive 'y' or 'yes' response before uploading.
Option --save skips uploading entirely and saves locally.
As this adds several new options, the entire option-parsing
process was rewritten to use OptionParser.
For completeness, support for --version was added as well.
This change also moved the version number out of the .gemspec,
into "lib/showterm/version.rb".