1
0
mirror of https://github.com/Tarrasch/zsh-autoenv.git synced 2024-11-17 21:40:59 +02:00
Commit Graph

191 Commits

Author SHA1 Message Date
Mickaël PERRIN
f5951dd0cf
Declare variable "line" locally (#101)
Fixes #100
2024-06-04 22:47:50 +02:00
Daniel Hahler
e9809c1bd2 README: improve .venv example 2018-09-14 04:01:21 +02:00
Daniel Hahler
c60241f9d9
Add helper functions for $PATH manipulation (#90) 2018-09-14 03:46:43 +02:00
Daniel Hahler
2c8cfbcea8
Handle setopt shwordsplit (#89)
This uses `emulate -L zsh` (as a more broad approach to `setopt
localtoptions noshwordsplit`, or quoting things) in the entry points to
zsh-autoenv.

Fixes https://github.com/Tarrasch/zsh-autoenv/issues/75
2017-12-16 01:09:41 +01:00
Daniel Hahler
0bb85014e6
Optimize _autoenv_stack_entered_contains (#88)
Only make `$env_file` absolute once.
2017-12-16 01:04:13 +01:00
Daniel Hahler
12ed110764 Optimize _autoenv_authorized_env_file
This uses Zsh directly, instead of calling grep potentially twice for a
missing entry.
2017-12-16 01:03:54 +01:00
Daniel Hahler
1d15e0d1a9 _autoenv_hash_pair: use sha1sum for v1 hashes
shasum was replaced by sha1sum before, and appears to have been added
back accidentally in dfb5648.
2017-12-16 01:03:54 +01:00
Daniel Hahler
06e1f59d36 Travis: only run two jobs, using test_full 2017-12-16 00:22:26 +01:00
Daniel Hahler
8d2c53e856 tests: mv ZDOTDIR.{clobber,options} 2017-12-16 00:22:26 +01:00
Daniel Hahler
b92462ff2d tests: simplify ZDOTDIR setup, remove base
This makes it easier to run tests without providing ZDOTDIR.
2017-12-16 00:22:26 +01:00
Daniel Hahler
016426207c Add requirements to README
Zsh version 4.3.10 introduced the `:a` and `:A` modifiers that are used.

[ci skip]
2017-12-15 23:34:53 +01:00
Daniel Hahler
f9112d7459
tests: cleanup test_full (#86)
Changes tests/varstash_export.t to use `$TESTSHELL` provided by cram.
2017-12-15 23:24:12 +01:00
Daniel Hahler
76e387c766
Travis: actually use different ZDOTDIRs (#83) 2017-12-15 23:11:20 +01:00
Daniel Hahler
51c7421f10
_autoenv_hash_pair: do not use a subshell (#81)
As a side-effect this should fix
https://github.com/Tarrasch/zsh-autoenv/issues/39 in case it was still
an issue after all.
2017-12-15 15:59:11 +01:00
Rob Speed
84bb32a403 FIX: Compatibility with macOS/FreeBSD (#82)
Removed use of `sed` due to its behavior differing between GNU Coreutils and FreeBSD.
2017-12-15 15:58:39 +01:00
Daniel Hahler
f542734c08
Travis: sudo=false, language=generic (#74) 2017-12-14 01:19:50 +01:00
Daniel Hahler
bba8f04258
minor: fix doc / improve debug logging (#80) 2017-12-14 01:18:44 +01:00
Daniel Hahler
468fa71d15
Fix tests: match $CRAMTMP more losely (#78)
Fixes https://github.com/Tarrasch/zsh-autoenv/issues/76.
2017-12-14 00:53:53 +01:00
Daniel Hahler
d6bfdff968
Fix (auto)unstashing when being sourced from a subdir (#79)
Fixes https://github.com/Tarrasch/zsh-autoenv/issues/77.
2017-12-14 00:53:25 +01:00
Daniel Hahler
9074633a29 README: recipes: fix "Environment file for all project" to use :a
Ref: https://github.com/Tarrasch/zsh-autoenv/pull/73
2017-11-02 02:42:26 +01:00
Rob Speed
7e0d027b21 _autoenv_get_file_upwards: do not dereference symlinks (#73)
This prevents issues where autoenv scripts use $0. When a shell enters the directory holding the autoenv scripts, it works as expected with $0 being the path to the symlink. However, if the shell enters one of its child directories the path to the script is dereferenced, and $0 is instead the path to the symlink's target.

From `man 1 zshexpn`:

> A – Turn a file name into an absolute path as the 'a' modifier does, and then pass  the  result  through  the  realpath(3) library function to resolve symbolic links.

Note: Symlinks are dereferenced elsewhere for authorization, so that behavior is unchanged.
2017-11-02 02:40:45 +01:00
Daniel Hahler
2db6d69774 Merge pull request #71 from blueyed/minor
Minor code cleanup/optimization
2017-10-18 00:32:08 +02:00
Daniel Hahler
bdc6967fc9 Set varstash_dir for "leave" event (#72)
Fixes https://github.com/Tarrasch/zsh-autoenv/issues/45.
2017-10-18 00:31:43 +02:00
Daniel Hahler
3258f584ec Cleanup README (#70)
Fix issues reported by mdl and remove the unnecessary bitdeli badge.
2017-10-18 00:29:43 +02:00
Daniel Hahler
bcfdd75382 _autoenv_source: grep for unstash also
Just for consistency.
2017-08-19 15:39:59 +02:00
Daniel Hahler
e0fc4bb58a Better fix for return value of _autoenv_source
Follow up to 8763a5b.
2017-08-19 14:50:20 +02:00
Daniel Hahler
4b1cae055d Minor code cleanup/optimization 2017-08-19 14:28:03 +02:00
Daniel Hahler
c3afdc151f Improve debug logging in _autoenv_chpwd_handler (#57) 2017-08-19 13:55:35 +02:00
Daniel Hahler
b0d5ff456f minor: doc; improve autostash check 2017-08-18 16:20:51 +02:00
Daniel Hahler
32598b5850 Minor cleanup 2017-08-18 15:27:32 +02:00
Daniel Hahler
0f92983d1e Add autoenv-edit function to edit current env files (#68) 2017-08-11 14:15:46 +02:00
Daniel Hahler
aa140ac2a0 _autoenv_get_file_upwards: handle relative paths (#67)
If `$look_from` is `.` the resulting file path will be relative.
2017-08-11 10:33:40 +02:00
Daniel Hahler
b90d2c4f80 _autoenv_get_file_upwards: handle relative paths
If `$look_from` is `.` the resulting file patch will be relative.
2017-08-11 10:27:20 +02:00
Daniel Hahler
9ecb91480d README: improve recipe for virtualenv auto-activation
- check that VIRTUAL_ENV is non-empty, which might happen when
`deactivate` was called already.
- perform directory name abbreviation on the virtualenv path.
2017-05-24 18:02:49 +02:00
Daniel Hahler
4aeb48a02e Fix use of local in while loop. (#66)
For some reason it did not fail on Travis when only pushing the test
first?!

Also adds punctuation to already-stashed msg.
2017-05-16 22:58:25 +02:00
Daniel Hahler
738e6e965d AUTOENV_DEBUG=3 sets xtrace while sourcing; doc (#65) 2017-04-30 14:14:25 +02:00
Daniel Hahler
3a19a22140 Fix recipe: ensure that extendedglob is set (#64) 2017-04-27 22:39:52 +02:00
Daniel Hahler
435f54761b Merge pull request #63 from blueyed/varstash-fixes
Varstash fixes
2017-04-27 20:19:17 +02:00
Daniel Hahler
e454d1af37 minor: sync lib/varstash 2017-04-26 21:51:26 +02:00
Daniel Hahler
d09b85cc0a lib/varstash: simplify stash for Zsh 2017-04-26 21:51:11 +02:00
Daniel Hahler
c018ad8e66 lib/varstash: fix handling of exported vars with Zsh 5.3+
Upstream PR: https://github.com/cxreg/smartcd/pull/51
2017-04-26 21:50:11 +02:00
Daniel Hahler
3fc024eced README: add Recipes section with .venv activation (#58) 2017-04-24 00:41:27 +02:00
Daniel Hahler
0169704cdb tests: fixes for noclobber (#62) 2017-04-23 22:11:55 +02:00
Daniel Hahler
e4f63b1271 Makefile: allow to pass in TEST_SHELL (#60) 2017-04-23 14:26:22 +02:00
Daniel Hahler
41e0daa35f tests: test_autoenv_add_to_env: create auth file parent dir (#59)
This is required when running single test files, e.g. only cwd.t.
2017-04-23 14:24:17 +02:00
Rob Speed
dfb5648505 Automatically upgrade v1 hashes (SHA-1) to v2 (cksum) (#55)
A new parameter is added to `_autoenv_hash_pair` to specify the version, defaulting to the latest (2). It outputs a `cksum`-based hash for version 2 and `shasum`-based for version 1.
Moves logic to check for an entry in `$AUTOENV_AUTH_FILE` into its own function (`_autoenv_authorized_pair`), as it may need to be called twice.
Modifies `_autoenv_authorized_env_file` to check for v1 entries when v2 fails.

Fixes #53. Alternative implementation to #54.
2017-01-10 12:07:39 +01:00
Daniel Hahler
398b6f4f54 Use cksum instead of sha1sum for checksums (#54)
This provides better performance, but requires you to re-authenticate all files.

Fixes https://github.com/Tarrasch/zsh-autoenv/issues/53.
2017-01-05 01:16:21 +01:00
Daniel Hahler
448ceefd3a _autoenv_hash_pair: use sha1sum (C) instead of shasum (Perl) (#52)
This improves performance.
2016-12-15 16:36:35 +07:00
Arash Rouhani
0ad53b6ee6 Better ~/.env_auth deprecation hint (#51)
Don't print the dot so it's easier to copy and paste.
2016-11-29 16:50:32 +01:00
Daniel Hahler
d51b8ecccc Add a test for autostashing aliases (#44)
Ref: https://github.com/Tarrasch/zsh-autoenv/issues/43
2016-11-29 21:46:50 +07:00