Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(169)

Issue 1681363003: Add spell-checking to `gn help`. (Closed)

Created:
4 years, 10 months ago by Nico
Modified:
4 years, 10 months ago
Reviewers:
Dirk Pranke, brettw, jbroman
CC:
chromium-reviews, tfarina
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Add spell-checking to `gn help`. I tried porting a gyp copies step to gn, and one of the things I tried while doing so whas `gn help copies`. If help had spell-checking, it would've suggested `gn help copy`. Since that seems like a nice change, add this. Also stop printing full help output when a topic is not found, because then the "not found" error scrolls by so fast that I never see it. Demo: $ out/gn/gn help copyasdfasdf ERROR No help on "copyasdfasdf". Run `gn help` for a list of available topics. $ out/gn/gn help copies ERROR No help on "copies". Did you mean `gn help copy`? (There's another implementation of EditDistance() in components/ssl/error_classification.cc -- but that works based on strings not StringPieces and it doesn't have a "max_distance" parameter. Since there's only one other instance of this function, just having a second version of it seems preferrable over finding some place to put this function so it can be used from both places. I'm however improving the other copy a bit in https://codereview.chromium.org/1690593002/) BUG=none Committed: https://crrev.com/11afb324fa322a3d651124f3ca244c9595f84768 Cr-Commit-Position: refs/heads/master@{#375673}

Patch Set 1 #

Patch Set 2 : windows warnings #

Patch Set 3 : actually #

Patch Set 4 : #$^&*&^$ #

Total comments: 1

Patch Set 5 : rebase #

Patch Set 6 : move to string_utils, add tests #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+155 lines, -41 lines) Patch
M tools/gn/command_help.cc View 1 2 3 4 5 2 chunks +40 lines, -41 lines 2 comments Download
M tools/gn/string_utils.h View 1 2 3 4 5 2 chunks +15 lines, -0 lines 0 comments Download
M tools/gn/string_utils.cc View 1 2 3 4 5 1 chunk +59 lines, -0 lines 0 comments Download
M tools/gn/string_utils_unittest.cc View 1 2 3 4 5 1 chunk +41 lines, -0 lines 0 comments Download

Messages

Total messages: 18 (8 generated)
Nico
wdyt? cool? lame? If you like this, maybe a few others of gn's arguments could ...
4 years, 10 months ago (2016-02-10 16:01:37 UTC) #3
Nico
+dpranke here too (but maybe he'll want to wait for brettw for this, not sure)
4 years, 10 months ago (2016-02-10 23:39:32 UTC) #5
Dirk Pranke
I think this is a good idea, and the implementation lgtm , but we should ...
4 years, 10 months ago (2016-02-10 23:47:25 UTC) #6
brettw
LGTM https://codereview.chromium.org/1681363003/diff/60001/tools/gn/command_help.cc File tools/gn/command_help.cc (right): https://codereview.chromium.org/1681363003/diff/60001/tools/gn/command_help.cc#newcode146 tools/gn/command_help.cc:146: size_t EditDistance(const base::StringPiece& s1, This is exciting, I've ...
4 years, 10 months ago (2016-02-16 20:48:28 UTC) #7
Nico
On 2016/02/16 20:48:28, brettw wrote: > LGTM Thanks! > https://codereview.chromium.org/1681363003/diff/60001/tools/gn/command_help.cc > File tools/gn/command_help.cc (right): > ...
4 years, 10 months ago (2016-02-16 21:19:18 UTC) #8
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1681363003/100001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1681363003/100001
4 years, 10 months ago (2016-02-16 21:21:49 UTC) #11
commit-bot: I haz the power
Committed patchset #6 (id:100001)
4 years, 10 months ago (2016-02-16 21:58:08 UTC) #13
commit-bot: I haz the power
Patchset 6 (id:??) landed as https://crrev.com/11afb324fa322a3d651124f3ca244c9595f84768 Cr-Commit-Position: refs/heads/master@{#375673}
4 years, 10 months ago (2016-02-16 22:55:11 UTC) #15
jbroman
drive-by ex-post-facto comment https://codereview.chromium.org/1681363003/diff/100001/tools/gn/command_help.cc File tools/gn/command_help.cc (right): https://codereview.chromium.org/1681363003/diff/100001/tools/gn/command_help.cc#newcode227 tools/gn/command_help.cc:227: random_topics["buildargs"] = [=]() { PrintLongHelp(kBuildArgs_Help); }; ...
4 years, 10 months ago (2016-02-17 00:03:09 UTC) #17
Nico
4 years, 10 months ago (2016-02-17 20:43:53 UTC) #18
Message was sent while issue was closed.
https://codereview.chromium.org/1681363003/diff/100001/tools/gn/command_help.cc
File tools/gn/command_help.cc (right):

https://codereview.chromium.org/1681363003/diff/100001/tools/gn/command_help....
tools/gn/command_help.cc:227: random_topics["buildargs"] = [=]() {
PrintLongHelp(kBuildArgs_Help); };
On 2016/02/17 00:03:09, jbroman wrote:
> Sorry to drop in since I actually quite like this, but lambda default capture
> (which doesn't even seem necessary here -- is anything captured?) is banned by
> styleguide/c++/c++11.html (see http://chromium-cpp.appspot.com), and
std::function
> isn't approved yet either (Chromium largely uses base::Callback).
> 
> Since all of these seem to be valid as captureless lambdas, perhaps:
> 
> std::map<std::string, void(*)()> random_topics;
> random_topics["all"] = PrintAllHelp;
> random_topics["buildargs"] = []() { PrintLongHelp(kBuildArgs_Help); };
> // etc.

Thanks, good comments. Addressing them here:
https://codereview.chromium.org/1705123004/

Powered by Google App Engine
This is Rietveld 408576698