Commit Graph

58 Commits

Author SHA1 Message Date
Eric Nielsen 3567694a0f
Use repository's default branch
instead of hardcoding the default to `master`, when no branch is
specified in `zmodule`.
Fixes #422
2021-01-02 19:09:52 -05:00
Eric Nielsen 153c547466
Add build date in info
Fixes #421
2021-01-02 18:40:58 -05:00
Eric Nielsen dfbe535430
Also force update login_init.zsh
as we do for init.zsh, so behavior is symmetric. This guarantees that
both init.zsh and login_init.zsh will always have newer timestamps than
.zimrc after a build.
2020-11-23 09:40:13 -05:00
Eric Nielsen c6f0720abc
Fail when no parameter is provided to `-c|--cmd`
Forgot to add this check when the new option was introduced.
2020-11-07 14:42:04 -05:00
Eric Nielsen 78b4711750
Prompt before zimfw uninstall, unless `-q` is set
Prompt before uninstalling modules, so users have a chance to review the
list before moving forward with the action.
2020-10-26 19:32:25 -05:00
Eric Nielsen ef4fe38716
Narrow zmodule help text
to avoid the horizontal scroll on it in the https://github.com/zimfw/zimfw
GitHub homepage.
2020-10-11 12:24:01 -05:00
Eric Nielsen fbf0fe0ac6
v1.3.2 2020-08-01 09:39:07 -05:00
Eric Nielsen ccace0ca74
Clean compiled files from absolute path modules
We were already compiling at these paths, but not cleaning the compiled
files.
Fixes #399
2020-07-31 21:03:47 -05:00
Eric Nielsen 5059dd2c65
v1.3.1 2020-07-24 10:30:19 -05:00
Eric Nielsen 713b7b2f5d
Don't pipe to gunzip
gunzip should not try to seek the stream, but an issue was reported
in #407, where it fails with

    gzip: stdin: unexpected end of file

So we're writing to a file first just to be safer.
Fixes #407.
2020-07-23 21:58:39 -05:00
Eric Nielsen dc93d13903
v1.3.0 2020-07-05 09:36:21 -05:00
Eric Nielsen 1e4d1e784d
Fix _zimfw_build_login_init
Pattern must match from the beginning (`##`).
Also don't quote ${ZIM_HOME}. We don't want to have an array like
('${ZIM_HOME}' '/path/to/zim_home'), so it needs to be unquoted for the
uniqueness to work.
2020-07-04 14:59:37 -05:00
Eric Nielsen 9b02b41f47
Add `-c|--cmd` option to `zmodule`
so freely defined commands can be executed.

Fixes #405
2020-07-02 17:16:44 -05:00
Eric Nielsen 0941bb3956
v1.2.2 2020-06-09 21:39:39 -05:00
Eric Nielsen 99e6b31891
Init and compile local modules in their directories
instead of requiring that they're installed inside ZIM_HOME.

Fixes #399
2020-06-09 21:34:21 -05:00
Eric Nielsen 9890c9d503
v1.2.1 2020-05-26 08:02:25 -05:00
Eric Nielsen c0d786229c
Warning when no initialization found in a module
Some plugins don't follow the `module_name.plugin.zsh` name, as "it is
the wild west out there".

Fixes #395
2020-05-25 14:01:00 -05:00
Eric Nielsen e73285c4d1
Make cksum silent
so it behaves similar to `cmp -s`, which is what we had before.
2020-05-25 13:43:30 -05:00
Eric Nielsen 853e5a767c
v1.2.0 2020-05-17 10:30:14 -05:00
Eric Nielsen 8724686e85
Don't depend on `cmp` and `xargs`
as they requires busybox or diffutils and findutils.
Use `cksum` and `zargs` instead.

Fixes #393
2020-05-16 20:22:22 -05:00
Eric Nielsen 7e369ef9cf
Update zmodule usage text
Hopefully the README.md will look aesthetically better with a pre block
instead of switching between text and `code`.
2020-05-02 18:47:38 -05:00
Marko Vujanic d1103f34e5
Improve error message when module not installed
Closes #390
2020-05-02 17:50:34 -05:00
Eric Nielsen b3c7fde730
Use short `if` form instead of `&&`
See
http://zsh.sourceforge.net/Doc/Release/Shell-Grammar.html#Alternate-Forms-For-Complex-Commands
2020-02-03 20:49:52 -05:00
Eric Nielsen 13fb1ead73
v1.1.1 2020-01-26 15:42:03 -05:00
Eric Nielsen 6129062139
Fail when no modules defined in .zimrc
instead of allowing xargs to execute the action with no positional
parameters.

Also don't try to write to .latest_version if there's no write
permission. This is supposed to be a background/optional operation, so
we don't want to show an error message in this case.

And use Zsh globs instead of find with -exec, and find won't fail if
there's an error with the -exec command.
2020-01-26 15:33:17 -05:00
Eric Nielsen cbf142a988
Fix "no such file or directory" error
before initial check for latest version. Not all versions of Zsh or all
OSs are affected. Error seen with Zsh 5.6.2 running on FreeBSD is:

    _zimfw_version_check:10: no such file or directory: /path/to/.latest_version
2020-01-22 12:48:46 -05:00
Eric Nielsen d096b29cac
v1.1.0
Last-minute minor fixes:
* Delete .latest_version after upgrading. Having a cache brings in these
  complexities.
* Print warning to stderr, to distinguish it from the normal output.
* Update help to be in sync with the README.md.
2020-01-20 07:24:27 -05:00
Eric Nielsen 1341afe525
Optional async check for latest version
every 30 days, storing it in a .latest_version file.

Also allow disabling this with:

    zstyle ':zim' disable-version-check yes
2020-01-16 11:30:09 -05:00
Eric Nielsen 7fdf65c58f
Don't call _zimfw_build_login_init after upgrade
as it was being used to update the login_init.zsh script. BUT the
function mentioned, which updates that script, would only be updated
after zimfw.zsh is sourced again, so no point in trying to call it at
this point.
2020-01-13 15:00:09 -05:00
Eric Nielsen be2be83560
Check the latest version using `git ls-remote`
which is being used to list the latest tag starting with `v`.
Print a warning if it's different than the current version being used.
2020-01-13 13:14:31 -05:00
Eric Nielsen dab4b87a29
Add help and version actions 2020-01-13 12:24:43 -05:00
Eric Nielsen 6806bea72e
Download latest release instead of from master
Using GitHub URL to latest release asset as described in
https://help.github.com/en/github/administering-a-repository/linking-to-releases#linking-to-the-latest-release

There's a counter of release assets downloads, which is nice.
Download zimfw.zsh when installing, and zimfw.zsh.gz when upgrading, so
we can have separate counts.
2020-01-12 17:37:39 -05:00
Eric Nielsen 65d7f6d3d0
Swap curl and wget
Fixes #360
2020-01-11 16:45:20 -05:00
Eric Nielsen ee99fe8a36
Add `-v` (verbose) option
so the normal output is focused on the given action, and output for
additional steps perfomed after the given action is only shown in
verbose mode.

Also, the output of wget is only shown in verbose mode. This is because
wget always shows some output (to stderr) even when there are no errors.
See https://serverfault.com/q/70889/302338

This should give a friendlier output.
See #360
2020-01-11 16:34:36 -05:00
Eric Nielsen b9bca2d325
v1.0.1 2020-01-09 07:29:40 -05:00
Eric Nielsen 28e4345653
Fix zimfw clean-dumpfile when there's no matches
It fails with

    _zimfw_clean_dumpfile:4: no matches found: /path/to/.zcompdump(|.zwc(|.old))
2020-01-09 07:21:16 -05:00
Eric Nielsen 424526ebee
Refactor: extract _zimfw_print function 2020-01-09 07:13:31 -05:00
Marko Kaznovac 2cc69d5d6f
Add .zprofile to the list of startup files
Zim does not use/modify .zprofile in it's templates. For completeness/
performance, the .zprofile should be compiled/cleaned if present.

Ref: http://zsh.sourceforge.net/Intro/intro_3.html

Closes #358
2020-01-08 16:58:55 -05:00
Eric Nielsen 12a4bb6000
Zsh 5.2 does not recognize the :P modifier
It fails with

    _zimfw_build_init:8: unrecognized modifier `P'

The `:P` modifier was introduced in Zsh 5.3. Replace it by `:A`, as we
still want to keep compatibility with Zsh 5.2.

Fixes #349
2020-01-08 16:45:54 -05:00
Eric Nielsen dd84c41ae5
v1.0.0
Changes:
*  Reduce the Zim "core" to a single file
*  Simplify installation with an installation script (Closes #182)
*  Put the configuration into .zshrc instead of a separate .zimrc
   (Closes #288)
*  Do not support themes that require promptinit (See #325)
*  Generate a static script that does autoload the functions and source
   the modules

This version is not backwards-compatible with previous versions, so a
new installation of Zim is required.
2020-01-02 13:13:12 -05:00
Eric Nielsen 0b19b2f89a
Update README.md and zimfw output
due to latest changes on how Zim works.
2020-01-02 12:58:04 -05:00
Eric Nielsen 5587ea14da
Update autoload functions glob
based on glob used in Prezto:
https://github.com/sorin-ionescu/prezto/blob/1bc0da5f48init.zsh#L79
and in compinit:
https://github.com/zsh-users/zsh/blob/b816291a17/Completion/compinit#L499
2020-01-02 12:58:04 -05:00
Eric Nielsen ae3e71cb84
Don't create function digest files
At least until Zsh version 5.7.1, no performance improvement is observed
out of using those.

In some cases, the performance is even worsened, like when using

    autoload -w functions_digest.zwc

instead of

    autoload func_name1 func_name2 ...
2020-01-02 12:58:04 -05:00
Eric Nielsen aade4704b1
Generate login_init.zsh file
So we can have the following code in the zlogin template:

    source ${ZIM_HOME}/login_init.zsh -q &!

instead of depending on the zimfw function there. This allows fixing the
issue were a non-interactive login shell currently yields:

    command not found: zimfw.

To fully fix the issue, we also need a new zshenv template containing:

    ZIM_HOME=${ZDOTDIR:-${HOME}}/.zim

Templates will be updated in the install script.
2020-01-02 12:58:04 -05:00
Eric Nielsen 93bbc35634
Use ASCII characters only
we want to be a universal Zsh framework, and send the message that
"less is less"!  ;- )

Don't indent done and failed messages with an indicator, at the end of
actions, to differentiate them from intermediate okay and error messages.
2020-01-02 12:58:03 -05:00
Eric Nielsen 4b750cb72f
Fix zimfw failing in termux with NO_CASE_GLOB
that is set by the completion module.
This is a known still unsolved issue with termux.
See https://github.com/termux/termux-packages/issues/1894
2020-01-02 12:58:03 -05:00
Eric Nielsen 3ae4fec895
Use builtin cd -q
to bypass aliases and to avoid calling any chpwd hook functions.
2020-01-02 12:58:03 -05:00
Eric Nielsen eaebf1731c
Give credit to zrecompile doc in zshcontrib(1)
and make code closer to the one in the manual pages (unless for our code
style). Why reinvent the wheel?

This last change makes the arguments to zrecompile shorter (passing
relative paths instead of full paths to each function file).
The number of arguments can be huge. There are 1143 of them currently
for /usr/local/Cellar/zsh/5.7.1/share/zsh/functions!
2020-01-02 12:58:03 -05:00
Eric Nielsen 7139771ec6
Rename zimfw action clean-modules to uninstall
and have `zimfw clean` only do `clean-compiled` and `clean-dumpfile`.
Semantically, it makes much more sense because we will be then cleaning
temporary files that are later compiled/generated again, which is not
the case for a module (which we'll be uninstalling now instead of
cleaning).
2020-01-02 12:58:03 -05:00
Eric Nielsen 196a0585f7
Don't fail zimfw compile on empty fpath dir
otherwise it would fail with, for example

    zrecompile:zcompile:133: can't open file /usr/local/share/zsh/site-functions
2020-01-02 12:58:02 -05:00