From 89f91d417f6d3f05b7cdcf981cf6159746a92e48 Mon Sep 17 00:00:00 2001 From: "maruel@chromium.org" Date: Thu, 22 Aug 2013 18:37:13 +0000 Subject: [PATCH] Add transparent dash support to commands. This makes it easier to type without using the shift-key, so an user can type 'git cl set-commit' and it'll find CMDset_commit. R=xusydoc@chromium.org BUG= Review URL: https://chromiumcodereview.appspot.com/22918019 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@219054 0039d316-1c4b-4281-b951-d872f2087c98 --- subcommand.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/subcommand.py b/subcommand.py index 6afe3dcda..0b0fa6e30 100644 --- a/subcommand.py +++ b/subcommand.py @@ -119,6 +119,9 @@ class CommandDispatcher(object): It automatically tries to guess the intended command by handling typos or incomplete names. """ + # Implicitly replace foo-bar to foo_bar since foo-bar is not a valid python + # symbol but it's faster to type. + name = name.replace('-', '_') commands = self.enumerate_commands() if name in commands: return commands[name]