This is an archive of the discontinued LLVM Phabricator instance.

[PATCH] clang-query quit command
ClosedPublic

Authored by aaron.ballman on Aug 5 2015, 5:17 AM.

Details

Reviewers
klimek
pcc
alexfh
Summary

I would like to propose adding a clang-query command called 'quit' that terminates the clang-query interactive session. While Ctrl+C works well enough to terminate the application, it's not particularly discoverable, and it runs into an interesting conflict on Windows 10 where the terminal has received some love recently. Ctrl+C will perform a copy operation in the terminal now, depending on whether any text is selected or not. Muscle memory has made for some annoying mistakes recently for me.

I put together a patch that implements this functionality in terms of terminating the query session object.

Thanks!

Diff Detail

Event Timeline

aaron.ballman retitled this revision from to [PATCH] clang-query quit command.
aaron.ballman updated this object.
aaron.ballman added reviewers: klimek, alexfh.
aaron.ballman added a subscriber: cfe-commits.
klimek added a reviewer: pcc.Aug 5 2015, 5:27 AM

+pcc for the opinion of the creator :)

klimek added a comment.Aug 5 2015, 5:28 AM

For what it's worth, I think this looks good, mainly curious whether pcc has any remarks code-wise.

pcc edited edge metadata.Aug 5 2015, 12:21 PM

I normally quit clang-query, or pretty much any other interactive command line program, by typing end-of-file (Ctrl-D on Unix, Ctrl-Z <enter> on Windows). If this works on Windows 10 I'd rather users do it that way. We can make this more discoverable through documentation.

In D11761#218141, @pcc wrote:

I normally quit clang-query, or pretty much any other interactive command line program, by typing end-of-file (Ctrl-D on Unix, Ctrl-Z <enter> on Windows). If this works on Windows 10 I'd rather users do it that way. We can make this more discoverable through documentation.

While Ctrl+Z <enter> does terminate clang-query on Windows, it's an incredibly obtuse way to terminate an interactive application on Windows. (Having used Windows for 20 years, I had to go look up what Ctrl+Z does!) Saying "but we can document it" doesn't really change that fact; users can already look at the documentation on MSDN to learn that Ctrl+Break or Ctrl+C will send a SIGINT (Ctrl+Z sets the EOF indicator, which is even more obtuse).

I'm not certain that control codes to terminate interactive shell programs on Windows is as normal as it is on Unix-like systems.

~Aaron

Peter, any particular reason?

In D11761#218141, @pcc wrote:

I normally quit clang-query, or pretty much any other interactive command line program, by typing end-of-file (Ctrl-D on Unix, Ctrl-Z <enter> on Windows). If this works on Windows 10 I'd rather users do it that way. We can make this more discoverable through documentation.

While Ctrl+Z <enter> does terminate clang-query on Windows, it's an incredibly obtuse way to terminate an interactive application on Windows. (Having used Windows for 20 years, I had to go look up what Ctrl+Z does!) Saying "but we can document it" doesn't really change that fact; users can already look at the documentation on MSDN to learn that Ctrl+Break or Ctrl+C will send a SIGINT (Ctrl+Z sets the EOF indicator, which is even more obtuse).

I'm not certain that control codes to terminate interactive shell programs on Windows is as normal as it is on Unix-like systems.

~Aaron

+1 to that; I do think we want this to work well for windows users, and the expected knowledge is different

pcc accepted this revision.Aug 5 2015, 1:35 PM
pcc edited edge metadata.

You'd have had to look at the documentation (i.e. the "help" message) anyway to determine the right way to terminate the program. We can document Ctrl-{D,Z} there instead of introducing a new command.

But this isn't worth arguing about and I am clearly in the minority here, if you still think that adding a new command here is the way to go, LGTM.

This revision is now accepted and ready to land.Aug 5 2015, 1:35 PM
aaron.ballman closed this revision.Aug 6 2015, 4:58 AM
In D11761#218178, @pcc wrote:

You'd have had to look at the documentation (i.e. the "help" message) anyway to determine the right way to terminate the program. We can document Ctrl-{D,Z} there instead of introducing a new command.

FWIW (and I should probably be ashamed to admit this in public), but when I first ran clang-query in interactive mode, I tried "quit", then I tried "exit", and then I just went and End Tasked the application. Control codes didn't enter my thought process, and I didn't try "help" for another few sessions. Discoverability isn't just about reading documentation, it's about ecosystem "norms" too.

But this isn't worth arguing about and I am clearly in the minority here, if you still think that adding a new command here is the way to go, LGTM.

Thank you, I've commit in r244206

~Aaron