mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 16:34:47 +01:00
Try to open man page as help for subprocess commands
This makes for example 'sh?' equivalent to 'man sh', unless there actually exists a 'sh?' executable. Resolves #3204.
This commit is contained in:
parent
8576e9c22e
commit
5457ac1c94
2 changed files with 28 additions and 0 deletions
23
news/subprocess-help.rst
Normal file
23
news/subprocess-help.rst
Normal file
|
@ -0,0 +1,23 @@
|
|||
**Added:**
|
||||
|
||||
* Open man page when requesting help for subprocess commands, e.g. using ``sh?``
|
||||
|
||||
**Changed:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Deprecated:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Removed:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Fixed:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Security:**
|
||||
|
||||
* <news item>
|
|
@ -563,6 +563,11 @@ class SubprocSpec:
|
|||
raise XonshError(e.format(self.cmd[0]))
|
||||
except FileNotFoundError:
|
||||
cmd0 = self.cmd[0]
|
||||
if len(self.cmd) == 1 and cmd0.endswith("?"):
|
||||
with contextlib.suppress(OSError):
|
||||
return self.cls(
|
||||
["man", cmd0.rstrip("?")], bufsize=bufsize, **kwargs
|
||||
)
|
||||
e = "xonsh: subprocess mode: command not found: {0}".format(cmd0)
|
||||
env = builtins.__xonsh__.env
|
||||
sug = suggest_commands(cmd0, env, builtins.aliases)
|
||||
|
|
Loading…
Add table
Reference in a new issue