Commit graph

1988 commits

Author SHA1 Message Date
Vasilis Gerakaris
e762dc57ab
fix: handle None value on XSH.env if UPDATE_OS_ENVIRON is set` (#4507) 2021-10-15 12:27:34 -04:00
Vasilis Gerakaris
3457d7263f
refactor: display meaningful message when running xonsh -c "xonfig colors" (#4508)
Closes #4376.
2021-10-15 09:06:34 -04:00
Vasilis Gerakaris
a5fcfba8be
fix: implement __hash__ method for Env (#4512)
Allows caching in `lru_cache` for `tools.suggest_commands()`

Closes #4510
2021-10-14 17:00:39 -04:00
Noorhteen Raja NJ
20ef5a033c
Ap/trace (#4453)
* feat: use argparser-alias for trace

* test: add test for trace cli

* fix: qs

* fix: update import path

* docs:
2021-10-13 10:04:59 -04:00
Noorhteen Raja NJ
a3c1b2429e
argparserAlias - vox (#4437)
* feat: use argparser-alias for vox

* feat: vox.create --interpreter completions

* refactor: use func based completer

* fix: implement interpreter completion

* docs:

* refactor: update import path of cli_utils

* style: convert to f-strings

* fix: failing tests

* fix: failing tests

completer from base_completer appears
2021-10-13 10:02:06 -04:00
Gil Forsyth
1780ba63e3
Fix for fromdircolors crash on Windows (#4502) 2021-10-12 09:45:38 -04:00
Gabriele N. Tornetta
0a2ba6ca89
perf(readers): use mutable buffers (#4498)
This change uses the mutable bytearray to append bytes
from a queue for better performance.
2021-10-07 11:31:51 -04:00
Gabriele N. Tornetta
096926d6c8
perf: cache suggested commands (#4497)
Calls to `suggest_commands` would result in repeated calls to
the Levenshtein distance routine, which whilst optimally
implemented is still expensive. The change proposes to cache the
result instead.
2021-10-07 11:22:51 -04:00
Shanmukha Vishnu
18261c3ace
Fix #4467 (#4500)
* Fix #4467

Fix for Crash with FileNotFoundError when current working directory is deleted

* Fix #4467

Fix for Crash with FileNotFoundError when current working directory is deleted

* Fix #4467

FIx #4467

* Fix #4467

* Fix #4467

* Fix #4467
2021-10-05 10:08:56 -04:00
Noorhteen Raja NJ
e9688e013d
fix: not enough space for completions (#4477)
* fix: not enough space for completions

* discussion update

* docs:
2021-10-05 09:58:29 -04:00
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