feat(python): add `pyserver` alias to start an HTTP server (#10217)
Closes #10217
Diff
1diff --git a/plugins/python/README.md b/plugins/python/README.md
2index b95ffe6792ffc35d09ee61c15b953ecdf731f4ac..eeaa1148a3fdc5caccf3c5aaa20cc485b0b7106a 100644
3--- a/plugins/python/README.md
4+++ b/plugins/python/README.md
5@@ -3,17 +3,19 @@
6 The plugin adds several aliases for useful [python](https://www.python.org/) commands.
7 8 To use it, add `python` to the plugins array of your zshrc file:
9-```
10+
11+```zsh
12 plugins=(... python)
13 ```
1415 ## Aliases
1617-| Command | Description |
18-|------------------|---------------------------------------------------------------------------------|
19-| `py` | Runs `python` |
20-| `ipython` | Runs the appropriate `ipython` version according to the activated virtualenv |
21-| `pyfind` | Finds .py files recursively in the current directory |
22-| `pyclean [dirs]` | Deletes byte-code and cache files from a list of directories or the current one |
23-| `pygrep <text>` | Looks for `text` in .py files |
24-| `pyuserpaths` | Add --user site-packages to PYTHONPATH, for all installed python versions. |
25+| Command | Description |
26+| ---------------- | ------------------------------------------------------------------------------------- |
27+| `py` | Runs `python` |
28+| `ipython` | Runs the appropriate `ipython` version according to the activated virtualenv |
29+| `pyfind` | Finds .py files recursively in the current directory |
30+| `pyclean [dirs]` | Deletes byte-code and cache files from a list of directories or the current one |
31+| `pygrep <text>` | Looks for `text` in .py files |
32+| `pyuserpaths` | Add --user site-packages to PYTHONPATH, for all installed python versions. |
33+| `pyserver` | Starts an http.server on the current directory. Use `--directory` for a different one |
34diff --git a/plugins/python/python.plugin.zsh b/plugins/python/python.plugin.zsh
35index 276eb6f918ee80c79abd111a18affac1fd252aa7..896fae3ca21d8e3774b8f27cd8fdfe62bca170c2 100644
36--- a/plugins/python/python.plugin.zsh
37+++ b/plugins/python/python.plugin.zsh
38@@ -48,3 +48,6 @@ alias pygrep='grep -nr --include="*.py"'
3940 # Run proper IPython regarding current virtualenv (if any)
41 alias ipython="python -c 'import IPython; IPython.terminal.ipapp.launch_new_instance()'"
42+
43+# Share local directory as a HTTP server
44+alias pyserver="python -m http.server"