Commit graph

2078 commits

Author SHA1 Message Date
Alexander Sosedkin
c0a2673541
feat: style gitstatus separator (#4492) 2021-09-30 11:15:27 -04:00
Noorhteen Raja NJ
33a5689db2
feat: improve pip completer (#4476)
* feat: improve pip completer

* refactor: optimize imports

* fix: update tests for other completers

* fix: failing tests

* test: fix failing tests

* refactor: make error message clear

exception like KeyError will be more clear now

* qs import

* fix: failing tests on windows

* fix: failing tests on windows

* fix: failing tests on windows

* refactor: optimize imports
2021-09-26 11:33:09 -04:00
Noorhteen Raja NJ
fd5911f1a1
feat: add new environment variable to customize tracing (#4300)
* feat: add new environment variable to customize tracing

* fix: failing integration tests

trace variable set from runner

* refactor: rename the variable to XONSH_TRACE_SUBPROC_FUNC

* Update xonsh/procs/specs.py

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

Co-authored-by: Gil Forsyth <gforsyth@users.noreply.github.com>
2021-09-17 09:55:59 -04:00
Daniel Shimon
7ce53f1844
Always capture aliases (#4445)
* specs: Make sure sub-specs are always captured regardless of $XONSH_CAPTURE_ALWAYS

* procs: Ensure env is used in functional aliases

* news: Add always-capture-aliases

* tests: procs: Skip known issues

* tests: Restore all builtins in the 'xonsh_builtins' fixture

* tests: vc: Use monkeypatch to mock CommandsCache functions

* tests: main: Don't use the local machine's xonshrc
2021-09-15 15:14:28 -04:00
Michael Ramsey
c04a0997ed
Fix: EnvPath.add() not maintain uniqueness with Path objects on replace (#4461)
* Fix: EnvPath.add() not maintain uniqueness with Path objects on replace

* Update tools.py

Removed commented out code left in originally

* Add tests for EnvPath.add() function

* Add test for EnvPath.add() function with pathlib path

* Update tests for EnvPath.add() function to support winblows paths

* Fix xontribs meta page so github links clickable and one minor typo

* Update xonsh/xontribs_meta.py

updated as requested

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

Co-authored-by: Gil Forsyth <gforsyth@users.noreply.github.com>
2021-09-14 12:54:18 -04:00
Daniel Shimon
438c66dfc0
Env swap thread safety (#4465)
* environ: Implement InternalEnvironDict for thread-local overrides

* environ: Make `swap` thread-safe without leaks

Use thread-local storage to override the changes.
This way the changes can't leak to other threads.

* environ: Implement 'get/set_swapped_values' to pass to threads

* procs: Use swapped values in threaded subprocs

This is so the thread will use the same swapped values as the origin one.

* news: Add env-swap-thread-safety
2021-09-13 11:06:55 -04:00
Daniel Shimon
6df8a24fc9
Path completion in python code (#4457)
* completions: path: Fix completing a single-arg python code segment

* tests: completions: path: Test completing python code

* news: Add path-completion-in-python-code
2021-09-07 01:23:49 +03:00
Noorhteen Raja NJ
89f54ee10a
Ap/history (#4454)
* feat: use ArgParserAlias for history command

* feat: cli-utils: support parsing unknown args

* feat: use _unparsed for getting history slices

* fix: use show cmd as default

* fix: update history-diff to allow new format

* fix: make sure that history files are flushed

* fix: remove unused imports

* docs:

* fix: annotation error in older py versions

* refactor: split dispatch function
so that one can intervene before final call

* fix: py3.6-7 has no mock.call_args.kwargs properties

* fix: update _dispatch_func signature

* test: update tests for history-show parser

* fix: amalgam different import path

* fix: cli_utils not amalgamated

when importing as `from xonsh.cli_utils import ...` it is not lazy
loading
2021-09-06 21:38:37 +03:00
Noorhteen Raja NJ
9db8cc4591
Lab/lazy shell attrs (#4429)
* feat: async-prompt lazy load styles

around 0.15sec is offloaded to threads

* docs:

* fix: optimize imports
2021-09-05 23:39:23 +03:00
Samuel Dion-Girardeau
8c228ef061
Improve setup metadata (#4458)
* Add relevant Trove classifiers

From full list: https://pypi.org/classifiers/

* Add all project URLs

* Add keywords

Copied from the repo's tags, minus "hacktoberfest"

* Add news entry for the change

* Use more explicit key for repo URL
2021-09-05 10:45:00 +03:00
Noorhteen Raja NJ
aec4860625
Ap/dirstack (#4446)
* feat: use ArgparserAlias for dirs command

* refactor: update fn names

* docs:

* docs:
2021-09-02 22:44:00 +03:00
Noorhteen Raja NJ
0a4720b71a
feat: use ArgparserAlias for xontrib (#4441)
* feat: use ArgparserAlias for xontrib

* test: add test for xontrib-name-completer

* fix: bashisms tests should unload module after tests

* test: make assertion failure message obvious

* fix: failing tests because autovox is already loaded in some py versions
2021-09-02 22:17:45 +03:00
Noorhteen Raja NJ
6c22b84f80
Ap/disown (#4442)
* feat: use ArgParserAlias for disown command

* feat: add rich-completer

* docs: add news item

* fix: mypy error

* test: add disown completer tests
2021-08-28 19:38:05 +03:00
Noorhteen Raja NJ
076098899a
feat: use argparserAlias for xexec (#4440)
* feat: use argparserAlias for xexec

* docs: news item

* docs: add todo

* fix: failing tests

* fix: failing tests

* fix: update xexec--help test

* feat: add epilog if available to argparse

* feat: implement epilog section for xexec

* docs:
2021-08-28 17:23:20 +03:00
Noorhteen Raja NJ
c4b54e06a1
ArgparserAlias - xonfig2 (#4436)
* feat: use ArgparserAlias for xonfig

* test: update test for xonfig completions

* refactor: update docs

* refactor: use function based completer

* fix: remove old import

* docs:

* fix: merge issues

* test: move xsh_with_aliases to root conftest.py

* docs:

* feat: set subparser's prog from func-name
2021-08-28 14:09:59 +03:00
Anthony Scopatz
4bdc8822fa
More fixes for when Env is none in commands cache. (#4438)
* Env is not None

* allow env to be none in commands cache for xo
2021-08-27 17:28:25 +02:00
Noorhteen Raja NJ
54f5ae7bb2
Argparser/color+completion (#4391)
* feat: add colored help formatter and alias builder

closes #4284

* feat: add auto-completion support to argparser

* test: update test for completer

* fix: getting doc from params that have annotation

* refactor: use filter-function for checking alias completions

* doc: add discussion abount check for alias having parser

see discussion on
https://github.com/xonsh/xonsh/pull/4267

* type fix

* refactor: use function based completer

* test: fix failing argparser test

* docs: update news item

* update completion for argparser sub-commands to append_space

from comment on
https://github.com/xonsh/xonsh/pull/4267#discussion_r676044508

* docs: update docstring typo

* refactor: move inspect import to top

* feat: support option strings before positionals

and add env setting for showing completions for options by default

* test: update tests after adding new $ALIAS_COMPLETIONS_OPTIONS_BY_DEFAULT

* add suggested completion_context_parse fixture

* docs: add suggested doc for dispatch function

* refactor: use try/except for import of typing.annotated

* refactor: move complete_argparser_aliases to completers/aliases.py

* refactor: move argparser completer to its own module

* style:

* refactor: rename completer to not clash with argparse

* fix: expand option's descriptions

* fix: add completer/argparser to amalgam
2021-08-26 01:32:13 +03:00
cmidkiff87
10778ecaa5
fix check for app execution alias (#4428)
* fix check for app execution alias
issues #3752 and #4426

* added fallback check for pre 3.8

* added news item

* fix file formatting

* Forgot that os.stat() throws OSError for <= 3.7

* fix file formatting
2021-08-21 15:18:13 +02:00
Noorhteen Raja NJ
d7dbfa9011
Lab/py control file (#4420)
* feat: use python's compile for rc.py

* docs: add news item

* docs: update news item

* test: add tests for py-control files

* fix: rst news item

* docs: update news item

* docs: add sample rc.py
2021-08-19 12:40:22 -04:00
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