Describe the transcript archive's layout where it lives, and make help, decision and comment prose easier to find
This commit is contained in:
@@ -29,6 +29,14 @@ def simple_commands(command: str, cwd: str, home: str) -> list[Simple]:
|
||||
|
||||
|
||||
def segments(command: str) -> list[list[str]]:
|
||||
"""The command's simple commands as lists of words, split at ; & | ( ) and line breaks. Shell forms it does not parse:
|
||||
- a quoted string is one word, so `bash -c "git commit"` and `echo "$(git commit)"` hide the inner command;
|
||||
- a backtick substitution stays inside its words, while `$(git commit)` outside quotes splits into the `$` and a command of its own;
|
||||
- a keyword or a brace opens its command's words, so `then git commit` reads as the command `then`;
|
||||
- `<(...)` and `<<<` read as redirects, so the word after them is dropped as the target;
|
||||
- a file descriptor before a redirect, as in `2>&1`, stays a word;
|
||||
- variables, aliases and functions are not expanded;
|
||||
- a line with an unbalanced quote yields nothing."""
|
||||
text = uncommented(HEREDOC.sub(lambda heredoc: heredoc.group(0).split("\n", 1)[0], command))
|
||||
tokens = lexed(text)
|
||||
if tokens is None:
|
||||
|
||||
Reference in New Issue
Block a user