Commit graph

2194 commits

Author SHA1 Message Date
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
Angus Hollands
a1d94b822e
Refactor: reduce API surface of lexer (#4535)
* Refactor: code can *only* be None in else case.

* Refactor: make xonsh_code private as `_source`

* Refactor: make "token_stream" private

* Refactor: make "tolerant" private

* Refactor: add default for _token_stream

* Feat: implement Lexer.reset

* Refactor: cleanup local names in Lexer

* Refactor: make `source_slice` private.

Again, this is just a helper function so for now make it private.

* Refactor: use chained comparison

* Docs: add news

* Update refactor-lexer-parser.rst

Co-authored-by: Noorhteen Raja NJ <jnoortheen@gmail.com>
2022-01-17 16:53:14 +05:30
dev2718
404cbf5452
fix #4638 (#4640)
Co-authored-by: Alexander Firbas <alexander.firbas@gmail.com>
2022-01-14 08:57:08 -05:00
dev2718
cee33bbd7e
fix #4637 (#4639)
Co-authored-by: Alexander Firbas <alexander.firbas@gmail.com>
2022-01-13 09:33:41 -05:00
Noortheen Raja
0957c2d7eb feat: add env variable for sys level config dir
feat: add $XONSH_COMPLETER_DIRS

feat: implement path based completers

style:
2022-01-11 11:24:54 -05:00
Noorhteen Raja NJ
039294c362
Xompletions (#4521)
* feat: add command completers logic

* feat: implement xompleter logic

* fix: handle callable object in exception

* chore: add xompletions package to setup.py

* fix: update tests for changes to command completer logic

* docs:

* fix: qa errors

fixes #4514

* feat: add xonsh completions

* refactor: split module matcher to separate class

* feat: add django-admin completions

* fix: failing tests

* feat: add more properties to completion-context

* refactor: cleanup code

* todo item add
2022-01-10 11:21:22 -05:00
Hierosme
343ea33998
Add uname command, Update uptime comand (#3909)
* Add uname support

* Changelog addition

* Migration to platform module

* Update uptime.py for the last version
Merge the original uptime module to a single file
Change the bootime() return be stay compatible with xonsh
Add support for Haiku , suppose to close #3882
Add dependency from uptime to support to MacOS 10.10 by add _posix.c file.

* Update uptime.py for the last version
Merge the original uptime module to a single file
Change the bootime() return be stay compatible with xonsh
Add support for Haiku , suppose to close #3882
Add dependency from uptime to support to MacOS 10.10 by add _posix.c file.

* typo fix

* black reformat

* remove usage of print

* black is black

* add original test for uptime
convert original test via 2to3
black reformat tests

* strange syntaxe fixe for flaske8

* black the incredible tool it stop a bug fixe just because it THE tool it want a return for make less readable code

* flake8 the famous tool it permit to stop a big fixe without any information's about the trouble

* workaround about xonsh CI don't respect docstring specs

* RISC OS only comment thing

* black is a good jock in a CI

* black is a good jock in a CI

* roll back uptime.py

* look if we can make it work

* fixe all i understand

* add command in corutils alias

* reformat uptime.py with black

* fixe version

* try with xonsh xp.LIBC lib

* black in a CI is a stupid thing

* stupid Windows and it \r

* use os.linestep

* use newline simple wrapper

* use newline simple wrapper

* use newline simple wrapper

* use newline simple wrapper

* try osx rollback method

* fixe

* fixe

* a test on window via the CI because i haven't the OS

* a test on window via the CI because i haven't the OS

* a test on window via the CI because i haven't the OS

* fix: black: format

* refactor: update uname command

now has auto-completions

* docs: update news item and fix qa error

* refactor: remove unused file

* fix: qa imports

* refactor: update getting boottime

fallback to monotonic time on unix

* fix: update haiku compatibility in uptime

* refactor: add uptime to aliases

* refactor: move xoreutils tests

* fix: call aliases using xonsh

Co-authored-by: Tuux <tuxa@rtnp.org>
Co-authored-by: Noortheen Raja <jnoortheen@gmail.com>
2022-01-08 18:28:46 +05:30
Noorhteen Raja NJ
70dd8bf24b
fix: remove custom handling of osc tokens for ptk prompt (#4629)
https://github.com/prompt-toolkit/python-prompt-toolkit/blob/master/examples/prompts/finalterm-shell-integration.py

fixes #374
2022-01-07 17:34:52 -05:00
Peter Ye
b6c61e3343
Fix unpacking of dictionaries inside a dictionary (#4624) 2022-01-07 04:51:06 +05:30
Noorhteen Raja NJ
c01fc6efe3
refactor: do not override sys coreutils (#4617)
* refactor: do not override sys coreutils

* docs:
2022-01-05 09:44:53 -05:00
Peter Ye
8bf47f29be
ast: do not descend into any comprehensions (#4622)
* ast: do not descend into any comprehensions

* add test

* add news
2022-01-05 09:35:50 -05:00
Noortheen Raja
f5367f6083 feat: add upgrade command
fixes #2095
2021-12-23 06:32:47 +05:30
Noorhteen Raja NJ
c524028a78
fix: prompt getting git branch (#4607)
fixes #4450
2021-12-21 17:28:02 +05:30
Angus Hollands
5091c8368e
Refactor: make session loading explicit (#4540)
* Refactor: Don't modify XSH in Execer

This is not an invariant change - the __del__ method of the execer now does not unload the session. This is probably what we want - the session should be the final arbiter of when it goes out of scope, and we might need an explicit mechanism to handle this.

* Refactor: make import hook Execer explicit

This is ugly for now, but helps raise the global state modifications to the surface

* Style: run black

* Refactor: add `update_cache` to `CommandsCache`

Previously a lot of internal usage of `all_commands` was for the updating side-effect. Now we make that a separate routine.

* Refactor: remove args from XonshSession constructor

* Refactor: move non stateful XonshSession methods to __init__

* Refactor: don't create custom class for namespace

* Refactor: auto-generate set of default builtins

* Refactor: set session attributes to None in constructor

* Refactor: don't test hasattr for known attribute

* Refactor: add methods to restore and disable Python exit

* Refactor: add initial value for XSH.aliases

* Refactor: don't default getattr for known attribute

* Refactor: make _lastflush a closer and move to `load()`

* Fix: catch $path even if empty.

This shouldn't ever actually manifest itself, but whilst we're here!

* Refactor: support existing usage of install_import_hooks

* Style: run black

* Refactor: remove unneeded import

* Docs: add news item

* Fix: news item

* Refactor: remove unused arg

* docs: fix news item

* fix: no duplicate calls

add helpers properties to completion-context

* refactor: importing a module should not affect the session

the user has to have XSH loaded before

* fix: todo item for testing imphooks

Co-authored-by: Noortheen Raja <jnoortheen@gmail.com>
2021-12-21 13:07:53 +05:30
Noorhteen Raja NJ
888cb819c9
history transfer (#4604)
* refactor: update `history gc` cli usage

* feat: added `history transfer` command

cli-utils now provides hook to parser.add_argument call

* test: test refactor

* docs:

* fix: mypy error

* fix: remove debug line
2021-12-20 08:36:29 +05:30
Evan Hubinger
8fc3e1f5f6
Fix OSError on Windows with GnuWin32 (#4599)
* Fix OSError on Windows

* Clean up PR
2021-12-16 16:09:52 -05:00
Noorhteen Raja NJ
5a985427e7
feat: add sub-command to print current completions (#4586)
* feat: `completer complete` command is added to test current completions

* fix: tests
2021-12-12 08:47:47 +05:30
Angus Hollands
31978e7c61
Fix: support Conda environments when running on non-conda interpreter (#4532)
* Fix: support Conda environments when running on non-conda interpreter

* Chore: remove unused import

* Docs: add news item

* Update fix-conda-env-system.rst

* Update fix-conda-env-system.rst

Co-authored-by: Noorhteen Raja NJ <jnoortheen@gmail.com>
2021-12-10 10:18:16 +05:30
Noorhteen Raja NJ
7ee5b26064
feat: update command completions to show description as well (#4488)
* feat: update command completions to show description as well

closes #3823

* test: fix failing tests on windows

* fix: failing tests on windows machine
2021-12-07 10:33:41 -05:00
Noorhteen Raja NJ
9a8cc74c4b
refactor: remove xonsh.ptk2 module (#4570) 2021-11-30 08:22:31 -05:00
Noorhteen Raja NJ
adafa20b88
adopt NEP-0029 (#4568)
* chore: adopt NEP-0029 for py version deprecation policy

fixes #4560

* chore: drop py3.6 from CI

* docs: add news item

* fix: failing qa because latest version to flake8-bugbear

see https://github.com/PyCQA/flake8-bugbear/issues/208

* chore: require >=py3.7
2021-11-29 12:48:48 -05:00
Noorhteen Raja NJ
73609bf87a
feat: option to show only longest/descriptive arg-completions (#4483) 2021-11-29 10:56:20 -05:00
Noorhteen Raja NJ
b031047beb
add fish shell based completer (#4569)
* feat: add fish shell based completer

* refactor: use filter-func to filter results
2021-11-29 21:02:32 +05:30
Noorhteen Raja NJ
0053d55e3d
feat: auto-completion support for source-foreign (#4564)
* feat: auto-completion support for source-foreign

* feat: add completions for source-bash/zsh/cmd

* refactor: change the boolean flags names that defaults to True
2021-11-27 16:28:04 +05:30
Noorhteen Raja NJ
6d756ef7c9
Vox improvements (#4549)
* refactor: confirm before deleting the folder

fix: failing tests

* feat: shorter positional argument which is optional

cli-utils

* refactor: vox-default interpreter from system's default

* feat: add new vox commands info, wipe

* feat: add new vox commands toggle-ssp, runin, runinall

* feat: add new vox commands toggle-ssp, runin, runinall

* feat: add new vox commands project-set, project-get

* feat: implement vox new 'pip installs/requirements' and project linking

* test: update failing tests
2021-11-26 23:37:35 +05:30
omjadas
a49a538ab2
Simplify foreign functions (#4393)
* chore: simplify foreign functions

* fix: sourcing multiple foreign files

* refactor: address review comments

* Update docs/aliases.rst

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

* refactor: run black

Co-authored-by: Gil Forsyth <gforsyth@users.noreply.github.com>
2021-11-23 17:01:42 -05:00
Noorhteen Raja NJ
5f0ec33447
Ap/aliases completer (#4486)
* feat: create field to define alias-completer

this will resolve checking parser or alias. Now the alias can define how
it completes.

will solve
https://github.com/xonsh/xonsh/pull/4267#discussion_r676066853

* docs:

* fix: mypy error

* fix: rst qa

* style:
2021-11-23 12:34:12 -05:00