Commit graph

2270 commits

Author SHA1 Message Date
Peter Ye
be604e7f48
Change ![] to return an object for background command (#4823)
* Change ![] to return an object for background command

* Fix `fg` for commands started in the background

Fixes #4595

This issue was caused by `CommandPipeline.term_pgid` not being set for commands started in the background.
2022-06-05 21:10:21 +05:30
Italo Cunha
1e81146bd6
Support deletion in whole_word_jumping xontrib (#4788)
This binds Alt/Control+Delete/Backspace to support deletion matching
the motion bindings in `whole_word_jumping`.

Should work mostly out of the box on terminals that generate `\x7f`
when `backspace` is pressed and `\x08` when `control+backspace` is
pressed.  Tested to work on Microsoft Terminal (WSL2).  For
incompatible terminals, users can set `$XONSH_WHOLE_WORD_CTRL_BKSP
= False` to avoid configuration of the `control+backspace` binding.
2022-06-05 20:38:06 +05:30
Noorhteen Raja NJ
ecc1ab1020
xontrib load/unload (#4817)
* feat: add function to make event registration from function signature

* docs: add xontrib special functions description

* feat: handle xontribs with special functions

also reduce usage of XSH singleton

* fix: missing XSH

for now import singleton

* docs: fix .rst format

* fix: failing tests

* feat: implement primitive xontrib-unload and xontrib-reload

* chore: give explicit name

* docs: update doc
2022-05-30 15:33:17 +05:30
jbw3
42f081c8c7
Documenting the HISTCONTROL ignorespace option (#4825) 2022-05-28 21:22:27 +05:30
Peter Ye
259fbe540c
fix: do not append empty/comment-only input to history (#4822)
* add test for importing empty .xsh file

* test: empty lines do not get appended to history

prompt-toolkit needs its own test outside of test_base_shell.py because it uses a custom _push() method

* fix: do not append empty/comment-only input to history

Adds a compile_empty_tree argument to Execer.compile()
By default, the argument is `True`, and `compile()` returns a compiled `pass` statement for comment-only input.
When the argument is `False`, `compile()` returns `None` for comment-only input.

The base shell and prompt-toolkit shell use `compile_empty_tree = False` so that they get `None` as the compiled code and don't append the command to the history.

* add news

* fix tests
2022-05-26 17:50:08 +05:30
Noorhteen Raja NJ
93821fb363
refactor: removing prompt_ret_code xontrib (#4815) 2022-05-23 10:18:11 -04:00
Noorhteen Raja NJ
1e4eb3ade0
feat: filter completions from fish (#4765)
* feat: filter completions from fish

* docs:
2022-05-22 22:44:36 +05:30
Timmy Welch
b123273319
Fix environment variable completion in strings (#4804) 2022-05-21 10:54:36 +05:30
Peter Ye
11b2d6d086
Send SIGHUP instead of SIGKILL to clean up jobs (#4811)
Allows `nohup` command to work properly.
2022-05-20 23:09:24 +05:30
Gil Forsyth
400d2d6c56
fix: workaround method calls on attributes set to None (#4812) 2022-05-20 22:45:15 +05:30
Peter Ye
57f1e4bcbd
Fix bg command behaviour (#4810) 2022-05-20 08:45:03 +05:30
Gil Forsyth
572ebb576d
docs: change theme to furo (#4809)
Trying out a new theme -- I really like the way `furo` looks and I think
it makes it easier to navigate our overly dense docs pages.
2022-05-18 20:36:45 +05:30
dev2718
e62c0e9cec
Returncode enhancements (#4798)
Co-authored-by: Gil Forsyth <gforsyth@users.noreply.github.com>
2022-05-10 09:43:32 -04:00
Gil Forsyth
8933eb9d33 Updated CHANGELOG for 0.12.3 2022-05-08 16:58:38 -04:00
Noorhteen Raja NJ
15ff663530
Rm xontrib meta (#4790) 2022-05-04 15:02:20 -04:00
Peter Ye
baa4ade262
fix: item order of pretty-printed dictionaries (#4786) 2022-04-30 08:25:52 +05:30
doronz88
22cb921686
fix: remove os.path.basename from _get_git_branch() (#4783) 2022-04-27 22:11:13 +05:30
Noorhteen Raja NJ
73a880f76a
chore: drop py3.7 (#4770) 2022-04-26 09:00:31 -04:00
Gil Forsyth
e0a0394bfc Updated CHANGELOG for 0.12.2 2022-04-25 10:52:15 -04:00
Noorhteen Raja NJ
5da6a1babc
fix: gitstatus prompt (#4772) 2022-04-23 07:01:04 +05:30
Peter Ye
e1dc61eb04
fix: completions for command argument paths after equal signs (#4767)
* fix: completions for command argument paths after equal signs

* found a better solution to the problem
2022-04-21 21:08:30 +05:30
Noorhteen Raja NJ
ed9f032a47
Some fixes (#4763) 2022-04-17 10:06:08 +02:00
Peter Ye
09a77c15c9
Fix tab-completion trailing space for cmd arguments that use equals sign (#4750)
* Fix tab-completion trailing space for command arguments that use equals sign

* Add test for completion of path ending with equal sign

* Move test_path_completers.py to tests/completers

* Restore _quote_paths() to original behaviour

* Apply trailing equal sign fix to _bash_quote_paths()

Use _bash_quote_paths instead of _quote_paths in complete_from_bash()

* Do not need to pass quote_paths=_bash_quote_paths
2022-04-16 08:22:54 +05:30
Gil Forsyth
cd334e44e3 Updated CHANGELOG for 0.12.1 2022-04-15 13:10:59 +02:00
Gil Forsyth
6a8b059789
fix: guard modal cursor import for prompt toolkit (#4758)
We shouldn't fail to start if the available PTK version doesn't support
modal cursor stuff.
(We should probably also make modal cursor stuff optional, but that can
happen later)
2022-04-15 16:38:43 +05:30
Noorhteen Raja NJ
8ec73c763a
fix: setting builtins access to abbrevs (#4757) 2022-04-15 12:56:06 +02:00
Gil Forsyth
09a12e4e85 Updated CHANGELOG for 0.12.0 2022-04-14 15:09:22 +02:00
Noortheen Raja
1476f1adaa feat: add xontrib-django 2022-04-12 14:19:15 +05:30
Noortheen Raja
5ab9812f82 docs: 2022-03-26 17:43:51 +05:30
Daniel Shimon
34d92b0a39 news: Add virtualenv-activator-plugin 2022-03-26 17:43:51 +05:30
Noortheen Raja
c7068d2dee docs: 2022-03-24 19:49:30 +05:30
Ganer
b0abba7c75
Fix annoying console spam (#4722)
* Fix annoying console spam

* Create fix-non-callable-autocompletion

* Rename fix-non-callable-autocompletion to fix-non-callable-autocompletion.rst

Co-authored-by: Noorhteen Raja NJ <jnoortheen@gmail.com>
2022-03-22 12:58:49 +05:30
Noorhteen Raja NJ
d49b164379
gitstatus modular (#4697) 2022-03-21 11:18:36 -04:00
Peter Ye
e5af63bff7
Fix regex globbing for paths that contain special regex characters (#4715)
* Fix regex globbing for paths that contain special regex characters

* Skip regex globbing asterisk character tests on Windows

Asterisks are forbidden in Windows filenames. Plus signs are allowed in Windows filenames, so the plus sign tests run properly.
2022-03-20 01:10:57 +05:30
Kyllingene
1889d3e2ea
Clarified use of time_format in docs (#4714)
* Added reference to ``PROMPT_FIELDS`` section in ``time_format`` definition

* Forgot the news item, added now

* Generalized reference to PROMPT_FIELDS
2022-03-15 08:17:16 +05:30
Peter Ye
b581edb05d
Fix $XONSH_TRACEBACK_LOGFILE path expansion (#4713) 2022-03-15 00:31:24 +05:30
dev2718
78f9195227
fix 4343 by always trying greedy=True in _parse_ctx_free (#4699)
Co-authored-by: Alexander Firbas <alexander.firbas@gmail.com>
2022-03-07 01:53:34 +05:30
ylmrx
8e1a1f3342
fix: ptk now support modal cursor shape, use it when vi_mode is enabled (#4695)
* fix: ptk now support modal cursor shape, use it when vi_mode is enabled

* lint: use double-quotes

* bump ptk dependency in setup and integration

* lint: sorting imports
2022-03-05 15:45:32 +05:30
dev2718
d6588885ab
feat: colored tracebacks during interactive use (#4683)
* feat: colored tracebacks

* fix pygments import, remove promt_toolkit restriction

Co-authored-by: Alexander Firbas <alexander.firbas@gmail.com>
2022-02-26 22:50:52 +05:30
dev2718
0ba5bec86f
Feat: support for match statement for python >= 3.10 (#4672)
* feat: initial match statement support

* refactor assignment exprs for <3.8 compatibility; sort imports

* remove match extensions

* bump qa-workflow python version, minor alterations for qa-pipeline

* add mypy exception

* update mypy version

* Bump workflow main python version to 3.10

* remove outdated note

Co-authored-by: Alexander Firbas <alexander.firbas@gmail.com>
2022-02-25 17:00:00 +05:30
Oliver Bestwalter
81c8fe6bb9
make env_name aware of prompt in pyvenv.cfg (#4673)
* make env_name aware of prompt in pyvenv.cfg

prompt.env.env_name is now aware of the "prompt" key in pyvenv.cfg - search order from first to last is: $VIRTUAL_ENV_PROMPT, pyvenv.cfg, $VIRTUAL_ENV.

fixes #4670

* make env_name aware of prompt in pyvenv.cfg

prompt.env.env_name is now aware of the "prompt" key in pyvenv.cfg - search order from first to last is: $VIRTUAL_ENV_PROMPT, pyvenv.cfg, $VIRTUAL_ENV.

As the env_name is generated every time the prompt is generated, caching is used to only calculate it once for every venv path.

This introduces the possibility that the user will not get a correct env_name, when they change the cfg file or replace the whole venv and use different prompt settings the second time around. Although this is annoying and potentially confusing, it is still better than the situation before, where the prompt setting was simply ignored, although it is part of venv since python3.6 - so or now this might be seen as acceptable trade-off between speed and correctness.

fixes #4670

* make env_name aware of prompt in pyvenv.cfg

prompt.env.env_name is now aware of the "prompt" key in pyvenv.cfg - search order from first to last is: $VIRTUAL_ENV_PROMPT, pyvenv.cfg, $VIRTUAL_ENV.

As the env_name is generated every time the prompt is generated, caching is used to only calculate it once for every venv path.

This introduces the possibility that the user will not get a correct env_name, when they change the cfg file or replace the whole venv and use different prompt settings the second time around. Although this is annoying and potentially confusing, it is still better than the situation before, where the prompt setting was simply ignored, although it is part of venv since python3.6 - so or now this might be seen as acceptable trade-off between speed and correctness.

fixes #4670

* add type annotations

* always return str

This is more consistent and might also deal with a mypy error only observed on Ubuntu Linux python3.9

* remove unnecessary import

* adapt code to not break the documented API

When restructuring the code, I did not know that this was part of a documented API. This restores the API functions and updates the doc strings. New helper functions have been made private.
2022-02-21 23:39:07 +05:30
Oliver Bestwalter
7a04133611
implement vox create --prompt (#4676)
Pass the prompt arg through to venv.
Additionally, upgrade needs to be adjusted to keep a prompt setting if it is there.
2022-02-21 14:51:31 +05:30
Daniel
dbc71bd1a4
fix: '~' replaced to home/user by bash completion scripts breaks autocompletion (#4667)
* Improve bash_completer (#4664)

* add protection againts bash completion scripts which changes ~ to /home/user

* Add news file

* Run black

* Add new TC covering fix
2022-02-11 17:31:41 +05:30
dev2718
7e84e7b003
feat: make stracktraces behave like in python (#4662)
* feat: better stacktraces

* reraise SystemExit to enable proper exit codes and maintain old
behaviour in repl

* dont ignore exceptions when loading rc-files

* update tests with new SyntaxError formatting, new behavior that main
does not throw user exceptions

* pull return out of finally (flake8, B012)

* hide XonshError traces, fix mypy error, enable circumvention of trace suppression
with XONSH_DEBUG in non-interactive use

* fix mypy error

Co-authored-by: Alexander Firbas <alexander.firbas@gmail.com>
2022-02-04 09:16:44 +05:30
Ryan Delaney
ebba46ca7d
Add xontrib-gruvbox to xontribs_meta.py (#4663)
* Add xontrib-gruvbox to xontribs_meta.py

* Add news item for xontrib-gruvbox

Co-authored-by: Ryan Delaney <ryan.patrick.delaney+github@protonmail.com>
2022-02-04 07:40:53 +05:30
Noorhteen Raja NJ
e76115676b
improve completers (#4648)
* fix: pip -r appends spaces at the end

modularize completing output from subproc-out

* docs:

* fix: flake8

* fix: failing pip comp tests

* refactor: naming xonsh conflicts with actual package

the IDE completions don't work.
we add this naming convention instead.

* feat: option to filter after completion returned

this will help reduce some boilerplate, and we can enrich the filtering
behaviour

* feat: add gh completions

* fix: filtering out completions

* refactor: simplify invoking completer interface

* test: add fixture for xsh with os-env

* test: add tests for gh-completions

* fix: flake error

* fix: mypy errors and update gh completer tests

* fix: handle cross-platform line endings

* feat: include man,bash completer only if available

* todo: improve man page completions

* fix: failing man page tests

* fix: py 3.7 compatibility

* fix: qa error

* fix: stop dir completions

* feat: improve man page completions

now shows descriptions, recognizes more number of options correctly

* fix: update man page completions

* feat: support filtering based on display as well

* Update xonsh/completer.py

Co-authored-by: Gil Forsyth <gforsyth@users.noreply.github.com>

* style:

* test: xfail ptk-shell tests on windows

Co-authored-by: Gil Forsyth <gforsyth@users.noreply.github.com>
2022-01-27 21:22:36 +05:30
dev2718
63bdaee626
feat: implement $SHLVL mirroring bash's implementation (#4651)
* feat: implement $SHLVL mirroring bash's implementation

* reformat and add news entry

* add missing import

* add $SHLVL integration test

Co-authored-by: Alexander Firbas <alexander.firbas@gmail.com>
2022-01-24 07:24:28 +05:30
Angus Hollands
7eceb7f956
Feat: add Aliases.register (#4547)
* Feat: add `Aliases.register`

* Fix: return func from decorator

* Feat: support private name

* Fix: use local name

* Test: test aliases decorator

* Update news/feat-add-alias-decorator.rst

Co-authored-by: Gil Forsyth <gforsyth@users.noreply.github.com>

* Update feat-add-alias-decorator.rst

* Update test_aliases.py

* Update aliases.py

* Update test_aliases.py

* Update aliases.py

Co-authored-by: Gil Forsyth <gforsyth@users.noreply.github.com>
Co-authored-by: Noorhteen Raja NJ <jnoortheen@gmail.com>
2022-01-21 16:30:23 +05:30
dev2718
1aefbf3b35
Fix: detype None env-vars to '' to fix #4600 (#4649)
* detype untyped and path env-vars to ""; path_to_str("") == None

* update env-var-tutorial, add news

* update test_expandvars, test_expand_path, test_register_custom_var_str

* trigger CI-rerun since unrelated osx test failed

Co-authored-by: Alexander Firbas <alexander.firbas@gmail.com>
2022-01-21 14:46:50 +05:30
Noorhteen Raja NJ
0ea9dd8811
fix: xonfig web is not upto-date (#4606)
* fix: xonfig web is not upto-date

it should load data from backend

* refactor: update elm-compile module

* feat: update `xonfig web`

* todo:

* style:

* tmp

* feat: implements colors page

* feat: implement prompts page

* feat: implement xontribs page

* refactor: remove elm from project

* fix: qa errors

* docs:

* test: add test for xonfig.web

* fix: lru-cache call

* feat: add env variable for sys level config dir

* refactor: add method to handle post

* feat: implement updating prompts

* feat: implement xontribs update page

* style:

* fix: tests failure

* feat: add variables page

* feat: add abbrevs,aliases pages

* feat: run xonfig web in main process

this way we can update the current session

* style: optimize imports

* docs:

* refactor: write .xonshrc as the old code

* refactor: split file write functions
2022-01-18 11:11:16 -05:00