`os.path.expanduser` relies on the value of `$HOME` set in `os.environ`.
This meant that a user who set `$HOME` would then not end up in that
directory with a no-argument call to `cd` unless they had set
`UPDATE_OS_ENVIRON`.
Now the value of `$HOME` is respected regardless of the setting in `UPDATE_OS_ENVIRON`
* fix: Correctly multi line aliases
Bash aliases can span multi lines for readablity or if they are to long
for one line.
Here we just remove added the backslash before further processing.
* doc: Add news item for fix/parse-multiline-aliases branch
---------
Co-authored-by: Wilfried Pollan <wilfried.pollan@moqodow.com>
* [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.0.278 → v0.0.280](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.278...v0.0.280)
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fix: ruff linter errors
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Noorhteen Raja NJ <jnoortheen@gmail.com>
* refactor: project requires 3.9+
changed as per NEP-29
https://numpy.org/neps/nep-0029-deprecation_policy.html
* test: nose type tests are deprecated in pytest now
* fix: deprecation of ast.Str and ast.Bytes and .s attribute access
* fix: deprecation of ast.Num,ast.NameConstant,ast.Ellipsis
* refactor: upgrade code to be py39+ using ruff
the changes are auto-generated
* refactor: remove typing.Annotated compatibility code
* fix: temporarily disable having xonsh syntax inside f-strings
* test: skip failing tests
there is no workaround for this version. It might get solved in the
final release though
* refactor: make XonshSession.completer lazily populated
this speedsup the tests as cmd_cache would not be actively populated
when used in default_completers function
* refactor: make presence of walrus operator default
* Update and rename README to README.rst
* Create hello_world.py
* Update README.rst
* init
* remove bashisms
* Transfer abbrevs to xontrib-abbrevs
* Transfer free-cwd to xontrib-free-cwd
* news
* black
* Transfer fish-completer to xonsh/xontrib-fish-completer
* Transfer vox to xonsh/xontrib-vox
* Transfer pdb, xog to xonsh/xontrib-debug-tools
* remove hello_world
* fix tests
* black
* fix whitespaces
* fix readme
* Update python_virtual_environments.rst
* Update README.rst
* Update xontribs_transfer.rst
---------
Co-authored-by: a <1@1.1>
* Update tools.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* chdir
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: a <1@1.1>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* todo:
* refactor: remove usage of singleton in cmd-cache
* refactor: pass aliases/env to commands_cache on creation
reduce the usage of singletons
* fix: setting up mockups for tests
* feat: add $XONSH_CACHE_DIR
* refactor: use cache path to stire cmds-cache
* chore: todo
* feat: efficient cache commands per path and modified time
* refactor: move aliases to commands cache
now XonshSession is not needed to setup cmds-cache
* refactor: update tests
* fix: type annotation
* refactor: init aliases at commands-cache
* test: update failing tests
* fix: handle paths mtime changing
* docs: add news item
* refactor: remove $COMMANDS_CACHE_SIZE_WARNING
* fix: loading on windows fails because of setup sequence
* fix: failing tests
* Add XONSH_HISTORY_IGNORE_REGEX support
* Add changelog text
* Add cleanup notes for XONSH_HISTORY_IGNORE_REGEX
* Rename should_append to is_ignored
* Change is_ignored to a History method
* Remove unused re imports
* Docstring formatting cleanup, Black compliance
* Move XONSH_HISTORY_IGNORE_REGEX to History class
* Clarify with parenthesis
* Formatting compliance
* Add validate_ignore_regex check
* Remove validation comment
* Remove XONSH_HISTORY_IGNORE_REGEX test comments
* Add __init__ chaining to DummyHistory
* Add broken test for XONSH_IGNORE_REGEX
* Remove extra test variants
* Fix unit test environment variable name
* Add test for bad regex error output
* Remove unneeded __init__ chaining
* Add test_is_ignore
* Add is_regex and associated tests
* Add doc for XONSH_HISTORY_IGNORE_REGEX
* Change validate_ignore_regex to use is_regex
* Compile regex once and use a cached property
* Let cached_property handle saving regex
* Update terminal title before executing subprocess
This eliminates the need to use `pause_call_resume()`, which causes issues
when it sends SIGSTOP to a process that is in the middle of a syscall
(for example, the `swaymsg` command fails when it gets stopped during
a `recv` syscall).
Additionally, this approach is more flexible, as it allows captured
commands and callable aliases to also be updated as expected in the
terminal's title.
* Clear prompt cache in readline shell
* Add type annotation
* Use reset_key() to only reset current_job
* Convert into PromptField class
* Support PromptField with value of None
Allows {current_job:{} | } to work as expected when current_job is a
PromptField.
* Add tests
* Fixing bash completion bug when prefix started with '>', '<', or ':'
* Fixing code formatting
* More code formatting fixes
* Fixing test
* Refactor to fix bug by improving completion parser
* Supporting '<' and '>>' in completion parser
* Support for all IO redirect tokens
* Make job control task queue thread-local
This allows callable aliases to maintain a separate task queue from the
main thread.
* Make job control dictionary thread-local
Use XSH.all_jobs for the main thread and a separate dictionary for other
threads. This allows callable aliases to keep track of their jobs
separate from the main thread.
* Implement use_main_jobs() context manager
This allows threaded commands like jobs, disown, and bg to handle the
main thread's job control
* Run commands in the same process group if in a thread
* Fix tests that use jobs and tasks
* Add tests for subprocess call inside alias
* Add news
* Remove type declarations for _jobs_thread_local
Fixes the mypy error: "Type cannot be declared in assignment to non-self attribute"
Co-authored-by: Noorhteen Raja NJ <jnoortheen@gmail.com>
* Update test_pip_completer.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* feat: add support for f-glob strings
Move xonsh_pathsearch() into the BaseParser class because it needs to use self._set_error()
Parametrize 6 backtick tests in test_parser.py into test_backtick() (and add cases for f-glob strings)
* add news
* docs: update tutorial
* fix news file
* Change ![] to return an object for background command
* Fix `fg` for commands started in the background
Fixes#4595
This issue was caused by `CommandPipeline.term_pgid` not being set for commands started in the background.
* feat: add function to make event registration from function signature
* docs: add xontrib special functions description
* feat: handle xontribs with special functions
also reduce usage of XSH singleton
* fix: missing XSH
for now import singleton
* docs: fix .rst format
* fix: failing tests
* feat: implement primitive xontrib-unload and xontrib-reload
* chore: give explicit name
* docs: update doc
* add test for importing empty .xsh file
* test: empty lines do not get appended to history
prompt-toolkit needs its own test outside of test_base_shell.py because it uses a custom _push() method
* fix: do not append empty/comment-only input to history
Adds a compile_empty_tree argument to Execer.compile()
By default, the argument is `True`, and `compile()` returns a compiled `pass` statement for comment-only input.
When the argument is `False`, `compile()` returns `None` for comment-only input.
The base shell and prompt-toolkit shell use `compile_empty_tree = False` so that they get `None` as the compiled code and don't append the command to the history.
* add news
* fix tests
* We can't be sure there's a python binary
Debian doesn't currently ship a /usr/bin/python binary, unless a user
specifically installs python-is-python3.
However, we can safely assume that a python3 binary exists.
* Use shutil.which, as suggested in review