Commit graph

9942 commits

Author SHA1 Message Date
Noorhteen Raja NJ
28590cd4af
Code cleanup (#4260)
* style: reuse _repr_pretty_ function

* fix: remove mutable default args

prevent surprises :)

* refactor: remove unused variable from posix.py

* fix: unbound local variables

* fix: override signature match paren

* fix: revert changes to xonsh.codecache.splitpath

* refactor: remove unused class xonsh.procs.readers.BufferedFDParallelReader

* fix: annotate lazyobj decorator

now completions work in pycharm

* refactor: revert removing BufferedFDParallelReader
2021-05-11 01:46:25 +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
c4fedb0f83
trace captured (#4276)
Co-authored-by: a <a@a.a>
2021-05-10 17:50:57 -04:00
Andy Kipp
22cc03b462
docs: Fix image preview for the twitter (#4274)
* twitter

* twitter

* 3.6

Co-authored-by: a <a@a.a>
2021-05-10 09:38:24 -04: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
Daniel Shimon
8da682b7dc ptk: Disabled unwanted clipboard actions
Disable clipboard in the following ptk actions:
    ["kill-line", "kill-word", "unix-word-rubout", "unix-line-discard", "backward-kill-word"]
2021-05-09 22:41:31 +03:00
Daniel Shimon
0abdacce74 ptk: Wrap selection with quotes/parens with $XONSH_AUTOPAIR 2021-05-09 21:31:15 +03:00
Noorhteen Raja NJ
4dc08232e6
Fix commands cache testing (#4257)
* fix: update failing commands-cache tests

in some cases, the thread updates the binaries faster than the next call

* chore: upgrade black to 21.5b0

* chore: upgrade mypy to 0.812 version

* fix: handle corrupt commands-cache file

* fix: parser-table output dir. this should be same as the defaults

* fix: flake8 error
2021-05-06 09:54:09 -04:00
Luiz Antonio Lazoti
a5292f70d1
Fix IndexError with commands 'cd' or 'ls' a repo (#4240)
* Fix IndexError with commands 'cd' or 'ls' a repo

* update syntax
2021-04-28 10:44:57 -04:00
Andy Kipp
6d0c23e16f
Close 4215: Added env variable to ignore ./ and ../ in filepath completion (#4241)
* Added env variable to ignore ./ and ../ in filepath completion

* Changed ignore_dots to complete dots as always, never, or upon matching

* Updated news

* Added default 'matching'

* Update ignore_dots.rst

* black

* fix test

* tests

Co-authored-by: Bailey Morgan <bailey.mccarty.morgan@gmail.com>
Co-authored-by: a <a@a.a>
2021-04-27 09:28:17 -04:00
jmoranos
9d0f371e3d
Removed branch color from vertical bar in gitstatus (#4229) 2021-04-26 15:41:54 -04:00
Matthias Bussonnier
6bf5010350
DOC: Autoreformat most of the docs. (#4233)
this uses https://github.com/Carreau/velin to try to autoreformat all
docstrings in xonsh/*.py

In particular in Parameters section the space before the colon is
necessary for numpydoc to properly find the name and the type.

When no type is there numpydoc says that colon should be removed.

This also try to find if there are typo in parameter names and fix them
when possible.

As a sideeffect of parsing with numpydoc and reconstructing the
docstring from the parsed data some whitespace information is lost; but
that has the advantage of making the whitespace rules uniform
everywhere.
2021-04-21 11:39:49 -04:00
Noorhteen Raja NJ
cb7db29991
Feature/speed up startup (#4106)
* feat: use saved commands_cache between runs

this will speed-up startup time by a small factor (around 0.15s on my
system with ssd and ryzen5)

* test: update env-variable handling for cmds-cache tests

* refactor: add env-variable to control saving commands-cache

* refactor: mypy error fix for commands_cache

* fix: update handling max(iterable

* test: add tests for commands-cache new version

* docs: update env variable doc

* test: add more test for commands-cache caching behaviour
2021-04-21 11:38:06 -04:00
Gil Forsyth
120210cb5e
Delete codecov.yml (#4232)
* Delete codecov.yml

codecov got hacked, rather badly, and we aren't going to send them anything ever again

* Remove codecov badge and remove from requirements
2021-04-15 10:16:09 -04:00
Andy Kipp
039ce96dcd
feat: Added ability to get arguments list in ExecAlias (#4201)
* black

* news

* test

* alias_argN

* ExecAlias docs

* note about merge operator

* $args

* docs

Co-authored-by: a <a@a.a>
2021-04-15 09:39:13 -04:00
francium
c563ebb7a2
Improve homepage navigation links (#4228) 2021-04-15 09:36:34 -04:00
Andy Kipp
3785cbf8b4
XONSH_SUBPROC_CAPTURED_PRINT_STDERR to False (#4231)
Co-authored-by: a <a@a.a>
2021-04-13 13:21:43 -04:00
Andy Kipp
c243d4d86a
Put history json to subdirectory (#4211)
* New json history will be in XONSH_DATA_DIR/history_json directory.

* black

* exception + black

Co-authored-by: a <a@a.a>
2021-04-12 15:40:34 -04:00
Daniel Shimon
0ac7051db3
Improve bash completions - Pass parsed command line to py-bash-commands (#4219)
* completers: bash: Fix begidx calculation error

* completers: bash: Pass parsed args and quotes to py-bash-completion

* news: Improve bash completions
2021-04-12 15:37:35 -04:00
Andy Kipp
e7b0977910
feat: Added environment variable to hide unwanted printing the stderr when using captured object. (#4221)
* Added XONSH_SUBPROC_CAPTURED_PRINT_STDERR

* black

Co-authored-by: a <a@a.a>
2021-04-12 15:31:45 -04:00
Andy Kipp
16884fc605
Update test_main.py (#4223) 2021-04-07 14:37:21 -04:00
Andy Kipp
5a792a6eec
Please click the 👍 reaction (#4210) 2021-03-31 12:16:23 -04:00
Andy Kipp
7f7f8758a4
Added xontrib-macro-lib (#4206)
* docs

* Update xontrib_macro_lib.rst

* Update xontribs_meta.py

Co-authored-by: a <a@a.a>
2021-03-31 12:15:49 -04:00
Gil Forsyth
7c62a74e0c
Update author aliases 2021-03-30 13:48:34 -04:00
Evgeny
3df1426f8e
Updated references to point to 'main' instead of 'master' (#4202)
* doc: update path to the most recent xonsh source code ('master' to 'main')

* doc: change 'master' to 'main' in some doc references
2021-03-30 13:40:43 -04:00
Daniel Shimon
224fc55e41
Completion context (#4017)
* completion-context: Add CompletionContextParser placeholder

Implements the xonsh (tab-)completion context parser.
This parser is meant to parse a (possibly incomplete) command line.

* completers: tools: Implement ``contextual_completer`` decorator

This is used to mark completers that want to use the parsed completion context.

* completers: Enable using contextual completers in xonsh/completer.py

* completers: readline, ptk, jupyter: Enable using contextual completers

Pass ``multiline_text`` and ``cursor_index`` to ``Completer.complete()``

* parsers: base: Refactor out a ``raise_parse_error`` function

* tokenize: Enable ``tolerant`` mode

If ``tolerant`` is True, yield ERRORTOKEN instead of
    throwing an exception when encountering an error.

* lexer: Enable ``tolerant`` mode

Tokenize without extra checks (e.g. paren matching).
When True, ERRORTOKEN contains the erroneous string instead of an error msg.

* tests: lexer: Test ``tolerant`` mode

* completion-context: Implement simple CommandContext parsing

* completion-context: tests: Test simple CommandContext parsing

* completion-context: Implement parsing sub-commands

* completion-context: tests: Test parsing sub-commands

* completion-context: Add news file

* completion-context: parser: Add parser table path to relevant locations

Code-coverage, mypy ignore list, etc.

* completion-context: Implement parsing partial strings and line continuations

* completion-context: tests: Test parsing partial strings and line continuations

* completion-context: Convert ``Span`` object to a ``slice``

* completion-context: Refactor out ``create_command`` and ``cursor_in_span``

* completion-context: Implement handling empty commands

* completion-context: tests: Test handling empty commands

* completion-context: Implement handling multiple commands

Separated by newlines, `;`, `and`, `or`, `|`, `&&`, `||`

* completion-context: tests: Test handling multiple commands

Separated by newlines, `;`, `and`, `or`, `|`, `&&`, `||`

* completion-context: Implement handling python context

* completion-context: tests: Test handling python context

* completers: tools: Add `contextual_command_completer`

* completers: Make `complete_skipper` contextual

* completers: Make `complete_from_man` contextual

* completers: Make `complete_from_bash` contextual and add test

* completers: Make `complete_pip` contextual and update tests

* completers: Keep opening string quote if it exists

* completion-context: Handle cursor after a closing quote

For example - cursor at the end of ``ls "/usr/"``.
1. The closing quote will be appended to all completions.
 I.e the completion ``/usr/bin`` will turn into ``/usr/bin"``
2. If not specified, lprefix will cover the closing prefix.
 I.e for ``ls "/usr/"``, the default lprefix will be 6 to include the closing quote.

* completion-context: tests: Test handling cursor after a closing quote

* completion-context: Fix bug with multiple empty commands

e.g. `;;;`

* completion-context: tests: Speed up tests

From ~15 seconds to ~500 ms

* completion-context: Expand commands and subcommands

* completion-context: Simplify `commands` rules

* completion-context: Simplify `sub_expression` rules

* completion-context: Simplify editing a multi-command token

* completion-context: Inline `create_command`

* completion-context: Implement `contextual_command_completer_for` helper

* completers: Make `complete_cd`/`complete_rmdir` contextual and add tests

* completers: path: Don't append a double-backslash in a raw string

When completing a path, if a raw string is used (e.g. `r"C:\Windows\"`),
there's no reason to append a double-backslash (e.g. `r"C:\Windows\\"`).

* completers: Make `complete_xonfig`/`complete_xontrib` contextual and add tests

* completers: Make `complete_completer` contextual and add tests

* completers: Make `complete_import` contextual and add tests

* completion-context: Add python `ctx` attribute

* completion: tools: Simplify `RichCompletion` attributes handling

* completers: Make `base`, `python`, and `commands` contextual

* Add tests
* No need for `python_mode` completer anymore

* completion: tools: Add `append_space` attribute to `RichCompletion`

* completion-context: Get all lines in a main python context

* xontrib: jedi: Make the `jedi` completer contextual

* completers: tools: Remove `get_ptk_completer` and `PromptToolkitCompleter.current_document`

These aren't needed anymore now that contextual completers can access the multiline code (via `PythonContext.multiline_code`).

* completion-context: ptk: Expand aliases

* completion-context: jupyter: Expand aliases and fix line handling

* completer: Preserve custom prefix after closing quote

* completers: bash: Ensure bash completion uses the complete prefix

* completers: pip: Append a space after a pip command

* completers: pip: Prevent bad package name completions

* completers: Remove a common prefix from `RichCompletion` if `display` wasn't provided

* completion-context: Treat cursor at edge of `&& || | ;` as normal args

This will be used for completing a space

* completers: Complete end proc keywords correctly
2021-03-30 13:37:56 -04:00
Andy Kipp
9618fa2a36
Added casting CommandPipeline to int, hash, str (#4205)
* cast

* test

* added tests and str

* news

* test

* skip windows

* docs

* docs

* tests

Co-authored-by: a <a@a.a>
2021-03-30 13:36:01 -04:00
bhawkins
7168b262ae
Fix garbage collection of JSON history specified in seconds. (#4098)
* Fix garbage collection of JSON history specified in seconds.

* Add news entry.

* Avoid possible off-by-one error

* Make size_over return value easier to reason about.

* Update gc_seconds test cases.

Co-authored-by: bhawkins <bhawkins@github.com>
2021-03-22 16:20:36 -04:00
Andy Kipp
06ca2b0d13
Catch callable in the arguments list (#4191)
* catch callable

* news

* bump tests

Co-authored-by: a <a>
2021-03-22 16:17:54 -04:00
Andy Kipp
c30e4689c0
fix: and/or colorize (#4188)
* fix

* bump tests

Co-authored-by: a <a>
2021-03-22 16:13:21 -04:00
Andy Kipp
275b9e770d
fix: xpip sudo behavior in xonsh appimage (#4192)
* fix

* simplify

* black

Co-authored-by: a <a>
2021-03-22 16:07:30 -04:00
Daniel Shimon
4fffe2d1e5
Improve which output (#4196)
* xoreutils: which: Make `which` command aware of ExecAlias

* aliases: exec-alias: Remove unneeded newline at end of src

It isn't needed for the exec to work

* news: Improve `which` output for ExecAlias
2021-03-22 16:06:41 -04:00
Evgeny
90ac2f3865
update imphooks encoding regex to match the newer version at PEP 263 (#4162)
* update imphooks encoding regex to match the newer version at PEP 263

* fix: add proper backslash-escaping to the imphooks encoding regex

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

Co-authored-by: Gil Forsyth <gforsyth@users.noreply.github.com>
2021-03-22 14:13:13 -04:00
Gyuri Horak
234c444f79
#4148 TITLE can be set to a function (#4190) 2021-03-22 13:40:12 -04:00
Daniel Shimon
8a6f8bfeef
showcmd: Fix docs (#4195) 2021-03-22 10:59:29 -04:00
Andy Kipp
b9065eba89
Update robots.txt (#4197) 2021-03-22 10:54:59 -04:00
Andy Kipp
8ad8b043e8
feat: Added ability to set XONSH_HISTORY_FILE (#4175)
* Added ability to set XONSH_HISTORY_FILE before loading the history backend.

* black

* using XONSH_HISTORY_FILE

* tests

* black

* Convert WindowsPath to str

* Update xonsh/environ.py

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

* cleaning

* test sqlite

* test dummy

* typo

* fix 3.6

Co-authored-by: a <a>
Co-authored-by: Gil Forsyth <gforsyth@users.noreply.github.com>
2021-03-16 17:07:11 -04:00
Andy Kipp
38e1383b63
Update tutorial.rst (#4174)
Co-authored-by: a <a>
2021-03-16 13:52:11 -04:00
Andy Kipp
7217aee92f
docs: fix wizard text (#4172)
* Update xonfig.py

* Update xonsh/xonfig.py

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

Co-authored-by: a <a>
Co-authored-by: Gil Forsyth <gforsyth@users.noreply.github.com>
2021-03-16 13:51:38 -04:00
Andy Kipp
4975fa7f8f
Update contact.rst (#4169)
Co-authored-by: a <a>
2021-03-16 11:50:35 -04:00
Gil Forsyth
f1d0af7b75
Change master -> main in github workflows (#4185) 2021-03-16 10:21:19 -04:00
Andy Kipp
6cbf604deb
fix (#4181)
Co-authored-by: a <a>
2021-03-16 09:53:05 -04:00
Evgeny
1dfb947cf9
fix: use 'utf-8-sig' instead of 'utf-8' to allow importing user modules with a 'UTF-8 with BOM' encoding (#4161)
Closes #4160
2021-03-15 17:04:45 -04:00
Andy Kipp
8620976282
fix: Not load history in not interactive (#4178)
* fix history reading

* black

* clean

* make None

* unused

* back to DummyHistory

Co-authored-by: a <a>
2021-03-15 11:15:15 -04:00
Andy Kipp
f32c36b600
fix xonfig (#4173)
Co-authored-by: a <a>
2021-03-12 09:45:36 -05:00
Andy Kipp
c1118f3180
docs: copy robots.txt second try (#4171)
* Update conf.py

* Delete robots.txt

* Create robots.txt
2021-03-12 09:39:48 -05:00
Andy Kipp
1269a6a393
Update conf.py (#4170) 2021-03-11 12:33:27 -05:00
Andy Kipp
d51963538d
docs: small changes (#4165)
* docs

* docs

* talks

Co-authored-by: a <a>
2021-03-11 09:09:36 -05:00