Commit graph

2109 commits

Author SHA1 Message Date
Gordon Ball
e59ac28d7d
Support --rc DIR (#4422)
* args: accept --rc dir to load dir/*.xsh

* test_main: add a test for --rc dir

* args: drop unused --config-path, not read anywhere

* news: add entry for rcdir changes
2021-08-19 12:14:20 -04:00
Gordon Ball
14c2c3ce62
Don't modify XONSHRC and XONSHRC_DIR during startup (#4408)
* xonshrc_context: return loaded instead of context, don't touch env

This function returned the context, but the return value is not used by
the sole call site (and would inconsistently be either the env or ctx
depending on other arguments). Redefine the function to return what was
loaded.

The function will also no longer touch the environment variables
XONSHRC, XONSHRC_DIR or LOADED_RC_FILES.

* XonshSession: add rc_files list, and set in start_services

* LOADED_RC_FILES: drop completely

* xonfig: add RC files

* test_main: update tests for changes to XONSHRC{,_DIR}

* news: add entry for xonshrc changes
2021-08-17 11:01:41 -04:00
Noorhteen Raja NJ
1919b7dc80
fix: ptk completer renders new line as ^J (#4419)
* fix: ptk completer renders new line as ^J

* docs: add news item

* fix: failing tests

* style:
2021-08-16 22:14:11 +03:00
Ali Uneri
e955591bcb
Use full paths when launching processes on Windows (#4077)
* Use full paths when launching processes on Windows

Addresses issue #3763.

* Add news item

* Suppress stderr from "which"

* Replace xonsh.xoreutils.which with shutil.which

* Use existing resolved binary location

* Ensure PATHEXT mock is not overwritten

* Add tests for running excutables on windows

* Ensure we don't set overwrite command when binary_loc is none

* tweak tests

* Revert "Ensure PATHEXT mock is not overwritten"

This reverts commit ce5d6ac091.

* Use monkeypatch for chdir

Co-authored-by: Morten Lund <melund@gmail.com>
2021-08-16 22:02:12 +03:00
Daniel Shimon
5c2938c77c
Improve import completions (#4396)
* completers: Add 'import' completion functions from ipython

* completers: Add 'import' completions cache

* completers: Use ipython logic for 'import' completions

* completers: Use ipython logic in completing imported objects

* news: Add improve-import-completions

* tests: completers: Update 'import' completions tests

* completers: Apply lint to new 'import' completions

* completers: Check objects from __all__ are modules when needed

* tests: completers: Add multiple imports tests
2021-08-16 12:01:50 -04:00
Gyuri Horak
7cd840b2a5
Added xontrib-pyrtn to xontrib list (#4413)
* Added `xontrib-pyrtn` to xontrib list

* IPython typo fix
2021-08-16 13:45:10 +03:00
Noorhteen Raja NJ
ca9338149c
fix: vox system_site_packages option not passed (#4404)
* fix: vox system_site_packages option not passed

* docs: add news item

* docs: add todo nit
2021-08-11 09:46:32 +03:00
Daniel Shimon
406d20f78f
Make CTRL-Backspace configurable via $XONSH_CTRL_BKSP_DELETION (#4411)
* ptk: key-bindings: Make CTRL-Backspace configurable via True

* ptk: key-bindings: Support True windows
2021-08-10 13:24:01 +03:00
Anthony Scopatz
e3db8b6621
Env is not None (#4410) 2021-08-07 02:08:46 +03:00
Peter Ye
d08006b0e0
Change !() to also capture background subprocesses (#4406)
* Change !() to also capture background subprocesses

* Add test

* Add news

* Simplify logic
2021-08-01 21:58:19 +03:00
Daniel Shimon
f5acbe30d4
Ctrl backspace delete word (#4402)
* ptk: key-bindings: Add CTRL-Backspace to delete a single word

* news: Add ctrl-backspace-delete-word
2021-08-01 00:38:31 +03:00
Daniel Shimon
5322aafc66
Complete environment description (#4397)
* completers: env: Add env var's description

* news: Add complete-environment-description

* completers: env: Use generator

* completers: env: Show var type in display

* tests: completers: env: Update tests
2021-08-01 00:37:54 +03:00
Daniel Shimon
279d0ec638
Auto suggest word alias (#4401)
* ptk: key-bindings: Add CTRL-Right to auto-suggest a word

* news: Add auto-suggest-word-alias
2021-07-29 12:50:47 +03:00
Daniel Shimon
8dac83a9a0
Fix jedi path completion (#4400)
* xontrib: jedi: Don't complete paths with '~'

* tests: xontrib: jedi: Update tests

* news: Add fix-jedi-path-completion
2021-07-29 10:02:25 +03:00
Evgeny
6591346243
feat: add xontrib-homebrew (#4389)
replaces xontrib-linuxbrew by expanding OS support to Homebrew on macOS
2021-07-28 10:17:55 -04:00
Daniel Shimon
a72a9eb08e
Procs wsl1 check (#4387)
* xonfig: Print WSL version

* procs: Use pipeline groups in WSL2

* news: Add procs-wsl1-check
2021-07-26 16:34:00 -04:00
Daniel Shimon
e9b12c8b70 Updated CHANGELOG for 0.10.1 2021-07-24 22:47:37 +03:00
Gyuri Horak
98d4d2a184
Short color token name support for register_custom_style() (#4339) (#4342) 2021-07-24 18:37:51 +03:00
Jeremy Schlatter
09fcab65d2
fix surprising scoping behavior in execx and xonsh -c (#4363) (#4364)
* fix #4363

* fix test_integrations.py

* add tests for issue 4363

* fix regression

* add news item

* fix formatting with black

* fix news formatting
2021-07-24 17:17:37 +03:00
Daniel Shimon
91e8e52e76 Updated CHANGELOG for 0.10.0 2021-07-22 02:51:00 +03:00
Jeremy Schlatter
db99b64635
code simplifications (#4373)
* code simplifications

* add blank news item

There seems to be a CI check that requires this for each PR, But this
seems like it shouldn't be included in the next release notes, so I'm
leaving it blank.
2021-07-18 09:15:15 +03:00
Peter Ye
86f02c0341
Stop $() from silently capturing stderr (#4336)
* Stop $() from silently capturing stderr

* Add test
2021-06-24 09:43:21 -04:00
Peter Ye
9b79e4186e
Enable bracketed paste mode for readline (#4337) 2021-06-24 09:31:54 -04:00
Peter Ye
715fb867b4
Fix parser for subprocess command with leading whitespace (#4331)
* Fix parser for subprocess command with leading whitespace

* Add tests for subprocess leading space

* Add news

* Parameterize parser tests
2021-06-22 18:42:01 +03:00
Daniel Shimon
f87be90d6f
procs: Add $XONSH_CAPTURE_ALWAYS variable for opt-in interactive capt… (#4283)
* procs: Add $XONSH_CAPTURE_ALWAYS variable for opt-in interactive capturing

* tests: Add tests for $XONSH_CAPTURE_ALWAYS

* tests: Fix tests wrt $XONSH_CAPTURE_ALWAYS

* news: Add optional-interractive-capture
2021-06-21 12:36:37 -04:00
Peter Ye
d33d60ee3e
Fix the handling of colons when mixed with comments (#4332)
* Add ends_with_colon_token tool

* Add execer test for comment ending with a colon

* Use ends_with_colon_token() to catch non-indented blocks in execer

* Use ends_with_colon_token() for automatic indentation in prompt_toolkit and readline

* Add news
2021-06-20 12:50:03 +03:00
Noorhteen Raja NJ
33d2a1f04e
feat: make completer accept generators (#4319)
* feat: make completer accept generators

fixes #3968

* docs: add news item

* refactor: handle None value of $COMPLETION_QUERY_LIMIT
2021-06-20 12:42:30 +03:00
Daniel Shimon
8e547d0008
linux: Quote command-not-found argument (#4317) 2021-06-15 19:56:26 +03:00
Peter Ye
354f446f54
Fix empty command error message (#4308)
* fix pathsplit

* fix error message for empty command

* add news

* fix formatting

* fix atdollar_no_output test
2021-06-11 14:11:19 +03:00
Noorhteen Raja NJ
45b588c52e
feat: add config option to hide gitstatus prompt fields (#4294)
* refactor: create namedConstants for std colors

* feat: add gitstatus hide option

* test: update test_vc to not leak xsh object
2021-06-11 02:24:24 +03:00
JackofSpades707
a4ca034b9c
Address ON_WSL() bug #4310 (#4311)
* Address ON_WSL() bug #4310

Solution for #4310
`return "microsoft" in platform.release().lower() # might be a better solution?`
`return "wsl" in platform.release().lower() # might be a better solution?`

* Addressed #4310 - Added output for ON_WSL

For some reason this wasn't included in the output when running `xonfig`
Perhaps this was on purpose, but wsl is pretty popular and cygwin is detected so I figure I'd address that

* only display "on wsl" field if we detect linux

* Corrected import

* added news entry

* minor clarification in news entry

* Update news/fix_wsl_detection.rst

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

* Update news/fix_wsl_detection.rst

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

* This should pass CI tests

Co-authored-by: Gil Forsyth <gforsyth@users.noreply.github.com>
2021-06-08 13:12:56 -04:00
Noorhteen Raja NJ
3ce8c9b337
add py310 (#4270)
* chore: adding py310 to ci

though this will require code/parser changes, this is to prepare for
upcoming adoption

* fix: set python version as string

* fix: reference to master -> main

* fix: coverage is not reported in master

- disable amalgamation
	1. during coverage report tests
	2. qa tools like mypy may follow imports
- use python 3.9 for coverage and qa report. since it will have more
coverage and better typing support

* chore: use py3.10 with setup-py action

* chore: add news-item check job

* fix: py3.10 error while starting

the match statement is not supported.
while the syntax support is only upto py3.8

* fix: news-item checker

* chore: enable fail report for py310 tests

* test: add test for ptk_shell
2021-06-07 13:40:40 -04:00
Daniel Shimon
099d301fae
Update completers tutorial (#4307)
* docs: completions: Improve RichCompletion and CompletionContext api docs

* docs: completers: Update tutorial

* completers: tools: Print non-default values in RichCompletion's __repr__

* completers: Add $XONSH_TRACE_COMPLETIONS variable

* news: Add update-completers-tutorial
2021-06-05 19:12:58 +03:00
Daniel Shimon
4c055d82e8
Update completer cli (#4299)
* completers: Add new completers after the non-exclusives

* completer: Print whether a completer is non-exclusive

* news: Add update-completer-cli
2021-05-30 09:42:55 +03:00
Daniel Shimon
7f8aeefae8
tests: Run tests with the amalgamated xonsh (#4290)
* tests: Run tests with the amalgamated xonsh

* tests: Test xonsh loads correctly interactively

* tests: Ensure tests run from amalgamated xonsh

* environ: Separate $XONSH_DEBUG and $XONSH_NO_AMALGAMATE

* tests: Keep XONSH_NO_AMALGAMATE in a comment for ease of debugging

* tests: Fix monkeypatch for amalgamated code
2021-05-28 15:42:37 +03:00
Chris Braun
63ad26997f
Handle cancelled futures in AsyncPrompt (#4286)
* Handle cancelled futures in AsyncPrompt

* Add changelog
2021-05-21 23:46:12 +03:00
Gordon Ball
e02c7d76c4
Test RC loading in different startup configurations (#4279)
* test_main: test lots of startup order combinations

This is based on the startup order described in
https://github.com/xonsh/xonsh/issues/4096#issuecomment-791991841
and adds an (ugly) parameterised test which tries lots of different
CLI combinations, and verifies which RC files (if any) get loaded,
and in what order.

* test_script_startup: skip on windows
2021-05-14 16:12:34 +03:00
Daniel Shimon
27db574d99
Fix annotated assignment (#4278)
* ast: Fix annotated assignment

* ast: Support annotated variable without a value

* tests: Test annotated assign statements

* news: Add annotated-assignment
2021-05-12 12:39:11 -04:00
Gordon Ball
d48c93bdb5
Add support for rc.d drop-in configuration directories (#4256)
* Add support for rc.d drop-in configuration directories

* main: change how --rc, --no-rc are handled

Explicitly pass --no-rc rather than signalling it as an empty --rc, to
indicate that we should suppress both XONSHRC and XONSHRCDIR in that
case.

* Rename XONSHRCDIR -> XONSHRC_DIR

* xonshrc_context: document setting env for XONSHRC_DIR

* main: --rc foo.xsh should suppress XONSHRC_DIR
2021-05-11 16:42:37 -04:00
Gyuri Horak
9400a7cbd4
Fix for crash if $XONSH_COLOR_STYLE is set to something invalid (#4253)
* Fix crash if gruvbox is set to something invalid

* unit test for `ansi_style_by_name` + news
2021-05-11 15:51:50 -04:00
Daniel Shimon
fe63279d26
Fix skip completer (#4263)
* completer: Refactor out complete_from_context

* completers: Fix `skip` completer calculation and completers invocation

* tests: Test commands completers

* news: Add fix-skip-completer

* completers: Make `complete_path` contextual
2021-05-11 15:49:45 -04:00
Andy Kipp
09b31bec10
feat: Add saving current working directory (cwd) to the history (#4271)
* Add saving current working directory (cwd) to the history

* Added XONSH_HISTORY_SAVE_CWD and create PromptHistorySetting section

* news

* Move dummy history to the distinct file

* tests

* tests

Co-authored-by: a <a@a.a>
2021-05-11 15:23:57 -04:00
Daniel Shimon
6df8fe9ba7
Non exclusive completers (#4259)
* completers: Move `apply_lprefix` to completers/tools.py

* completers: Implement non-exclusive completers

* completers: Make end_proc keywords and tokens non-exclusive

* completers: Implement environment vars non-exclusive completer

* news: Add non-exclusive-completers
2021-05-11 09:50:40 -04:00
Daniel Shimon
f960d4576f
Improve jedi completer (#4264)
* xontrib: jedi: Don't complete partial paths in commands

E.g. when completing "/bin/a" we don't want jedi to complete "/bin/abs"

* xontrib: jedi: Allow case-insensitive completions

* news: Add improve-jedi-completer
2021-05-11 13:10:58 +03:00
Daniel Shimon
35f1ba1819
Improve import completions (#4265)
* completers: import: Move `import` completer before `bash` completer

If this completer returns a result, it's definitely an import statement

* completers: import: Complete `import` keyword in `from ... import` statements

* news: Add improve-import-completions
2021-05-11 01:48:53 +03:00
Daniel Shimon
59819cf28f
Get obj name in help (#4266)
* help, superhelp: Use object `__name__` if it exists

* news: Add get-obj-name-in-help
2021-05-11 01:48:00 +03:00
Daniel Shimon
9f2b1419c7
Merge pull request #4275 from daniel-shimon/ptk-autopair-with-selection
ptk: Wrap selection with quotes/parens with $XONSH_AUTOPAIR
2021-05-11 01:43:34 +03:00
Daniel Shimon
3131e1c688
Merge pull request #4269 from daniel-shimon/ptk-disable-unwanted-clipboard-actions
ptk: Disabled unwanted clipboard actions
2021-05-11 01:41:45 +03:00
Andy Kipp
5c69e33b9b
Added history backend name to the xonfig. (#4272)
Co-authored-by: a <a@a.a>
2021-05-10 09:35:30 -04:00
Andy Kipp
0dc896c284
feat: Ability to call the program by name from callable alias with the same name without the infinite loop error (#4218)
* fix aliases infinite loop

* black

* cleaning

* skip_if_on_windows

* skip_if_on_windows

* bump tests

* bump tests

* skip test

* remove skipping test

* Update xonsh/procs/specs.py

Co-authored-by: Daniel Shimon <daniel.shimon22@gmail.com>

* Update xonsh/procs/proxies.py

Co-authored-by: Daniel Shimon <daniel.shimon22@gmail.com>

* Make alias names internal

* Tests

* Tests

* Tests

* tests

Co-authored-by: a <a@a.a>
Co-authored-by: Daniel Shimon <daniel.shimon22@gmail.com>
2021-05-10 09:30:41 -04:00