Add support to `rbtools` for command aliases.
Review Request #6491 — Created Oct. 22, 2014 and submitted
rbtools
aliases, which are defined in the.reviewboardrc
file,
come in two forms: aliases for otherrbtools
commands and aliases
for system commands. The former allows for convenient short-hand for
rbt
commands and the latter allows for more versatile and flexible
commands that utilize the shell. Aliases allow for positional variable
substition.rbtools
aliases are only attempted to be executed after
attempting to find an internal command and external command (named
rbt-<commandname>
) fail.Add documentation for
rbtools
aliases. Add a link to the
documentation index to reference the documentation forrbtools
aliases.Add unit tests to test the parameter substitution for
rbtools
aliases.
Unit tests pass.
Description | From | Last Updated |
---|---|---|
'StringIO' imported but unused |
reviewbot | |
'logging' imported but unused |
reviewbot | |
'sys' imported but unused |
reviewbot | |
'StringIO' imported but unused |
reviewbot | |
There should still be two blank lines here. |
david | |
Alignment is off here. |
david | |
How about: try: return args[index] except IndexError: return '' |
david | |
No need for this empty line. |
david | |
How about: use_shell = alias.startswith('!') if use_shell: cmd = shlex.split(alias[1:]) else: cmd = [RB_MAIN] + shlex.split(alias) |
david | |
Two blank lines between headers. Same below. |
chipx86 | |
Backticks are meant as references in ReST. Missing references are shown with italics, though. Did you mean quotes, or italics? |
chipx86 | |
It'd be nice to break this up into a few smaller paragraphs. Each conditional here ("If a position variable is … |
chipx86 | |
No blank line here. |
chipx86 | |
During my first read, it wasn't immediately clear about how this would affect things. OSError is so general that I … |
chipx86 | |
Should be on the same line. |
chipx86 | |
Where is $* handled? |
chipx86 | |
Can this mention that it'll handle argument replacement? |
chipx86 | |
I don't think this tests rbtools.api anymore. Probably an old comment. How about just saying "rbtools.utils"? |
chipx86 | |
'pipes' imported but unused |
reviewbot | |
Col: 56 E231 missing whitespace after ',' |
reviewbot | |
Col: 1 W391 blank line at end of file |
reviewbot | |
This seems like it could be much cleaner as a regex. |
david | |
You don't need this because of the final return call. |
david | |
Only one blank line between functions. |
justy777 | |
Only one blank line between functions. |
justy777 | |
And here. |
justy777 | |
Col: 1 E302 expected 2 blank lines, found 1 |
reviewbot | |
Col: 24 E711 comparison to None should be 'if cond is None:' |
reviewbot | |
Col: 80 E501 line too long (80 > 79 characters) |
reviewbot | |
This scares me :) So easy to have really bad bugs in command line string parsing. Can we leverage shlex.split() … |
chipx86 | |
No periods in test docstrings. Same below. |
chipx86 |
-
Tool: Pyflakes Processed Files: rbtools/commands/main.py rbtools/utils/tests.py rbtools/utils/aliases.py Ignored Files: docs/rbtools/rbt/aliases.rst docs/rbtools/index.rst Tool: PEP8 Style Checker Processed Files: rbtools/commands/main.py rbtools/utils/tests.py rbtools/utils/aliases.py Ignored Files: docs/rbtools/rbt/aliases.rst docs/rbtools/index.rst
-
- Change Summary:
-
remove unnecessary stringio import.
- Commit:
-
c3dc898a02245135beed0f104c041639abff5cdc1ecc58b8f8628f0e0ae3363c3c9e5d216368f7c5
-
Tool: PEP8 Style Checker Processed Files: rbtools/commands/main.py rbtools/utils/tests.py rbtools/utils/aliases.py Ignored Files: docs/rbtools/rbt/aliases.rst docs/rbtools/index.rst Tool: Pyflakes Processed Files: rbtools/commands/main.py rbtools/utils/tests.py rbtools/utils/aliases.py Ignored Files: docs/rbtools/rbt/aliases.rst docs/rbtools/index.rst
- Change Summary:
-
Formatting.
- Commit:
-
1ecc58b8f8628f0e0ae3363c3c9e5d216368f7c5e81e39ae25c76c6d51567e6cd459487e22747479
-
Tool: PEP8 Style Checker Processed Files: rbtools/commands/main.py rbtools/utils/tests.py rbtools/utils/aliases.py Ignored Files: docs/rbtools/rbt/aliases.rst docs/rbtools/index.rst Tool: Pyflakes Processed Files: rbtools/commands/main.py rbtools/utils/tests.py rbtools/utils/aliases.py Ignored Files: docs/rbtools/rbt/aliases.rst docs/rbtools/index.rst
- Change Summary:
-
Fix the issues in David's review
- Commit:
-
e81e39ae25c76c6d51567e6cd459487e22747479e6c473089cbc8f9138fa2dad960b8aee461bbbb7
-
Tool: PEP8 Style Checker Processed Files: rbtools/commands/main.py rbtools/utils/tests.py rbtools/utils/aliases.py Ignored Files: docs/rbtools/rbt/aliases.rst docs/rbtools/index.rst Tool: Pyflakes Processed Files: rbtools/commands/main.py rbtools/utils/tests.py rbtools/utils/aliases.py Ignored Files: docs/rbtools/rbt/aliases.rst docs/rbtools/index.rst
-
-
-
Backticks are meant as references in ReST. Missing references are shown with italics, though. Did you mean quotes, or italics?
-
It'd be nice to break this up into a few smaller paragraphs. Each conditional here ("If a position variable is specified ..." should probably be its own paragraph, in order to help with scanning the rules.
-
-
During my first read, it wasn't immediately clear about how this would affect things. OSError is so general that I had to look up how subprocess used it. It seems it'll only be raised primarily for "File not found" errors, and that commands themselves won't trigger them.
Might be nice just for future readers to add a comment saying that if we got an OSError, it's because the above command most likely does not exist, and we'll fall through to checking aliases.
-
-
-
-
I don't think this tests rbtools.api anymore. Probably an old comment.
How about just saying "rbtools.utils"?
- Change Summary:
-
Add support for
$*
which expands to all arguments - Commit:
-
e6c473089cbc8f9138fa2dad960b8aee461bbbb709308fd2d00911f49638c697f4af8a3cde341bd3
-
Tool: Pyflakes Processed Files: rbtools/commands/main.py rbtools/utils/tests.py rbtools/utils/aliases.py Ignored Files: docs/rbtools/rbt/aliases.rst docs/rbtools/index.rst Tool: PEP8 Style Checker Processed Files: rbtools/commands/main.py rbtools/utils/tests.py rbtools/utils/aliases.py Ignored Files: docs/rbtools/rbt/aliases.rst docs/rbtools/index.rst
-
-
-
-
Tool: Pyflakes Processed Files: rbtools/commands/main.py rbtools/utils/tests.py rbtools/utils/aliases.py Ignored Files: docs/rbtools/rbt/aliases.rst docs/rbtools/index.rst Tool: PEP8 Style Checker Processed Files: rbtools/commands/main.py rbtools/utils/tests.py rbtools/utils/aliases.py Ignored Files: docs/rbtools/rbt/aliases.rst docs/rbtools/index.rst
-
Tool: Pyflakes Processed Files: rbtools/commands/main.py rbtools/utils/tests.py rbtools/utils/aliases.py Ignored Files: docs/rbtools/rbt/aliases.rst docs/rbtools/index.rst Tool: PEP8 Style Checker Processed Files: rbtools/commands/main.py rbtools/utils/tests.py rbtools/utils/aliases.py Ignored Files: docs/rbtools/rbt/aliases.rst docs/rbtools/index.rst
- Change Summary:
-
Add the
_split_cmd
function to not rely onshlex
's behaviour. - Commit:
-
cc5c043d0c707d4cb064b8fb2e16a485c48ec1305625ccc7db29b9341f2eb2d7fb16e017468202d7
-
Tool: Pyflakes Processed Files: rbtools/commands/main.py rbtools/utils/tests.py rbtools/utils/aliases.py Ignored Files: docs/rbtools/rbt/aliases.rst docs/rbtools/index.rst Tool: PEP8 Style Checker Processed Files: rbtools/commands/main.py rbtools/utils/tests.py rbtools/utils/aliases.py Ignored Files: docs/rbtools/rbt/aliases.rst docs/rbtools/index.rst
-
-
-
- Change Summary:
-
Fix reviewbot's issues
- Commit:
-
5625ccc7db29b9341f2eb2d7fb16e017468202d79aefe25c63c6c31c4219ba9c109d417244972d07
-
Tool: Pyflakes Processed Files: rbtools/commands/main.py rbtools/utils/tests.py rbtools/utils/aliases.py Ignored Files: docs/rbtools/rbt/aliases.rst docs/rbtools/index.rst Tool: PEP8 Style Checker Processed Files: rbtools/commands/main.py rbtools/utils/tests.py rbtools/utils/aliases.py Ignored Files: docs/rbtools/rbt/aliases.rst docs/rbtools/index.rst
-
Tool: Pyflakes Processed Files: rbtools/commands/main.py rbtools/utils/tests.py rbtools/utils/aliases.py Ignored Files: docs/rbtools/rbt/aliases.rst docs/rbtools/index.rst Tool: PEP8 Style Checker Processed Files: rbtools/commands/main.py rbtools/utils/tests.py rbtools/utils/aliases.py Ignored Files: docs/rbtools/rbt/aliases.rst docs/rbtools/index.rst
- Change Summary:
-
Remove posix paramter from shlex.split; it defaults to true
- Commit:
-
7f05483a50e3ce7588a94b2048ebdb6c8bd19c697816b0dfb11fba3b65a560628f18c060da8ff638
-
Tool: Pyflakes Processed Files: rbtools/commands/main.py rbtools/utils/tests.py rbtools/utils/aliases.py Ignored Files: docs/rbtools/rbt/aliases.rst docs/rbtools/index.rst Tool: PEP8 Style Checker Processed Files: rbtools/commands/main.py rbtools/utils/tests.py rbtools/utils/aliases.py Ignored Files: docs/rbtools/rbt/aliases.rst docs/rbtools/index.rst