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

139 Commits

Author SHA1 Message Date
Daniel Hahler
ecf2b2961f Only source varstash lib if it's being used
I have noticed that `autostash` called an (accidentally)
defined/overwritten `stash` function.

While it's not possible to put this into a local scope, this will at
least make it less polluting by default (when autostashing is not used).

Additionally we could source it always (not just once), but then it
would only re-overwrite the function.

A better fix would be to prefix the functions explicitly, e.g.
`autoenv_autostash` etc.

Closes https://github.com/Tarrasch/zsh-autoenv/pull/42.
2016-04-28 20:44:05 +02:00
Daniel Hahler
f021750e89 _autoenv_ask_for_yes: handle/catch Ctrl-C and return 2016-03-06 20:27:15 +01:00
Daniel Hahler
8a80ba7f02 Quote assignments to pair/parent_file 2016-03-06 20:26:48 +01:00
Daniel Hahler
20046b46ba Add comment for "autoenv_debug: fix error with Zsh 5.0.5" 2015-11-18 19:28:37 +01:00
Daniel Hahler
6a91336b01 Makefile: test_full: use exit instead of return 2015-11-18 19:25:34 +01:00
Daniel Hahler
b68bedc562 Add tests/ZDOTDIR.shwordsplit 2015-11-18 19:25:07 +01:00
Daniel Hahler
1220d246b0 _autoenv_debug: fix error with Zsh 5.0.5
> _autoenv_debug:local:1: not valid in this context: handler:

Fixes https://github.com/Tarrasch/zsh-autoenv/issues/38.
2015-11-18 19:23:05 +01:00
Daniel Hahler
489bbb46fd README: add direnv to 'Related projects' 2015-11-12 22:30:55 +01:00
Daniel Hahler
aee9baa418 Merge pull request #36 from blueyed/fix-api-vars-scope
Cleanup API/vars for enter/leave events
2015-10-10 22:35:41 +02:00
Daniel Hahler
42d8bc9db6 Merge pull request #37 from blueyed/limit-autoenv_source_parent
Allow to limit `autoenv_source_parent`'s upward recursion
2015-10-10 22:35:28 +02:00
Daniel Hahler
eebdce22df Allow to limit autoenv_source_parent's upward recursion
This allows to use `autoenv_source_parent ..` to only look in the parent
directory.
2015-10-09 22:16:07 +02:00
Daniel Hahler
961190678e Cleanup API/vars for enter/leave events
The variables are local now, which makes them being handled correctly
when calling `autoenv_source_parent`.
Without this, a call to `autoenv_source_parent` overwrites the values in
the current scope.
2015-10-09 22:04:55 +02:00
Daniel Hahler
58268b8da3 doc: fix appearance of AUTOENV_DEBUG in README 2015-09-18 14:48:57 +02:00
Daniel Hahler
fadddf6502 Use shorter echo for newlines 2015-08-27 22:58:35 +02:00
Daniel Hahler
54b89914ff Use 'command cat'
Ref: https://github.com/Tarrasch/zsh-autoenv/pull/35#discussion_r38145031
2015-08-27 22:57:58 +02:00
Daniel Hahler
90d3b53505 Write _autoenv_check_authorized_env_file to stderr
stdout might be redirected, e.g. with "cd - >/dev/null", and this
message should appear in stderr probably anyway.

I've tried to add a test for this, by redirecting stdout in .zshenv, but
cram does not handle this well (and appears to redirect stderr to stdout
anyway).
2015-08-27 20:50:52 +02:00
Daniel Hahler
9a2660f939 Remove globals: _autoenv_source_dir, _autoenv_chpwd_prev_dir
The globals are not necessary and can cause problems with
AUTO_NAME_DIRS.

 - Use funcsourcetrace[1] instead of _autoenv_source_dir.
 - Use OLDPWD instead of _autoenv_chpwd_prev_dir.

Fixes #33.
2015-05-25 17:03:05 +02:00
Daniel Hahler
e68a914487 Change default values: .env => .autoenv.zsh etc
This changes the defaults:
 - AUTOENV_FILE_ENTER:   .env       => .autoenv.zsh
 - AUTOENV_FILE_LEAVE:   .env_leave => .autoenv_leave.zsh

`.env` is usually used only for key-value pairs for environment
settings, e.g. with foreman.  We do not want to interfere with this.

This also renames the setting/variable AUTOENV_ENV_FILENAME to
AUTOENV_AUTH_FILE, and uses the [XDG
spec](http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html#variables)
for the default location.

The new default location for the auth file will be
~/.local/share/autoenv_auth.

When the old setting is used, or the previous default exists, a warning
is given with instructions.

Fixes https://github.com/Tarrasch/zsh-autoenv/issues/31.
Closes https://github.com/Tarrasch/zsh-autoenv/pull/32.
2015-05-22 17:20:06 +02:00
Daniel Hahler
631ea30440 README: clarify that it won't load any .env file 2015-05-14 01:36:33 +02:00
Daniel Hahler
d6f37dbeb6 minor: doc for _autoenv_hash_pair 2015-05-09 18:25:32 +02:00
Arash Rouhani
12cfed6d3f Update README.md
blueyed: fixed some punctuation/grammar.

Closes https://github.com/Tarrasch/zsh-autoenv/pull/28.
2015-05-06 23:05:24 +02:00
Arash Rouhani
928a945e99 Merge pull request #27 from blueyed/add-doc
Huge update of the README (finally)
2015-05-06 21:24:28 +02:00
Arash Rouhani
335b71d58e Merge pull request #26 from blueyed/rename-env-leave
Change default for AUTOENV_FILE_LEAVE to .env_leave
2015-05-06 21:19:06 +02:00
Daniel Hahler
362c7fe00f Huge update of the README (finally) 2015-05-06 20:53:41 +02:00
Daniel Hahler
b0e23d29fe Change default for AUTOENV_FILE_LEAVE to .env_leave
This does not use a fake file extension (`.leave`) like with
`.env.leave`.
2015-05-06 20:28:23 +02:00
Daniel Hahler
470841ac3c Unset $autoenv_env_file when leaving
This allows to use $autoenv_env_file e.g. in your prompt to see what
.env is being used.
2015-04-24 17:36:41 +02:00
Daniel Hahler
fd54606830 tests: streamline ZDOTDIR layout, AUTOENV_ENV_FILENAME via setup
Without this, a new subshell would reset the env authentication file.
2015-04-24 17:33:09 +02:00
Daniel Hahler
d62fbffad3 Do not export AUTOENV_ENV_FILENAME, and use existing value 2015-04-24 17:28:09 +02:00
Daniel Hahler
bf1376fd8f travis: fix tests
- set SHELL=zsh
 - cd back for ZSH=5
 - fix/improve autoenv.plugin.zsh: no dirname, use ${0:h}
2015-04-23 21:52:25 +02:00
Daniel Hahler
473a0a32df travis: use 'sudo make' to fix zsh test
Build: https://travis-ci.org/Tarrasch/zsh-autoenv/jobs/59762278

Error:

   ./A04redirect.ztst: starting.
   *** /tmp/zsh.ztst.err.16143	Thu Apr 23 18:06:09 2015
   --- /tmp/zsh.ztst.terr.16143	Thu Apr 23 18:06:09 2015
   ***************
   *** 1 ****
   ! zsh:1: no such file or directory: /nonexistent/nonexistent
   --- 1 ----
   ! zsh:1: permission denied: /nonexistent/nonexistent
   Test ./A04redirect.ztst failed: error output differs from expected as shown above for:
     $ZTST_testdir/../Src/zsh -fc 'exec >/nonexistent/nonexistent
     echo output'
   Was testing: failed exec redir, no POSIX_BUILTINS
2015-04-23 20:24:30 +02:00
Daniel Hahler
e6e906e6b9 Fix _autoenv_get_file_mtime for zsh 4 (no pipefail option) 2015-04-23 19:55:21 +02:00
Daniel Hahler
b725b5da9b make test_full: use zsh 4 (/opt/zsh4/bin/zsh) and zsh 5 2015-04-23 19:54:44 +02:00
Daniel Hahler
5275eb398d travis: add zsh 4/5 to matrix 2015-04-23 19:24:21 +02:00
Daniel Hahler
5df54aca65 travis: fix env matrix (use a list) 2015-04-23 17:58:53 +02:00
Daniel Hahler
433693f5c6 Cleanup tests/varstash_export.t 2015-04-23 17:57:56 +02:00
Daniel Hahler
248bd5cc0d varstash: fix get_autostash_array_name for Zsh 4.3.17 (Travis) 2015-04-23 17:57:46 +02:00
Daniel Hahler
36846ae9b5 travis: use env test matrix for ZDOTDIR 2015-04-23 17:38:01 +02:00
Daniel Hahler
1797c25473 travis: cleanup, output zsh version 2015-04-23 17:34:59 +02:00
Daniel Hahler
7699fe6aba tests: rename setup.sh to setup.zsh 2015-04-23 16:03:21 +02:00
Daniel Hahler
ebef4c2613 tests: define/use $TEST_SOURCE_AUTOENV
This handled (re)loading autoenv for
ZDOTDIR=tests/ZDOTDIR.loadviafunction.
2015-04-23 16:00:15 +02:00
Daniel Hahler
102a3f2f44 make test_full: handle error return code from cram 2015-04-23 15:30:42 +02:00
Daniel Hahler
e29074c329 varstash: remove lib functions, use zsh functions 2015-04-23 15:27:39 +02:00
Daniel Hahler
c4e388980e varstash: add support for exported variables in subshells 2015-04-23 15:11:40 +02:00
Daniel Hahler
fe3d479b08 minor: doc 2015-04-23 15:11:05 +02:00
Daniel Hahler
5cf1e01b28 tests: setup.sh: export TEST_AUTOENV_PLUGIN_FILE 2015-04-23 14:40:26 +02:00
Daniel Hahler
8763a5b627 Fix return value of _autoenv_source; use ': $(( .. ))'
`(( foo++ ))` returns an error in case $foo is not defined.
2015-04-23 14:39:38 +02:00
Daniel Hahler
9a010cbdf6 Do not reset the stack variables when (re)sourcing the plugin
This is meant to keep the current state when re-sourcing the shell
config (`. ~/.zshrc`).

Closes https://github.com/Tarrasch/zsh-autoenv/pull/24
2015-03-30 00:58:32 +02:00
Arash Rouhani
611c1a1588 Merge pull request #25 from blueyed/set-errexit-during-setup
tests: setopt errexit during setup
2015-03-29 12:46:43 +02:00
Daniel Hahler
e8372e9cdf tests: setopt errexit during setup
This is meant to prevent accidentally overwriting your auth file when
running / changing the tests.
2015-03-15 22:16:12 +01:00
Joe Block
15bc1e3c62 Add zgen instructions 2015-02-18 20:25:28 +01:00