Commit Graph

116 Commits

Author SHA1 Message Date
Eric Nielsen 05b8e0cdf2
Add `--root` option to `zmodule`
which makes it straighforward to use repositories that contain multiple
modules, like sorin-ionescu/prezto or ohmyzsh/ohmyzsh.
2022-09-26 20:33:49 -05:00
Eric Nielsen 887bfd6a03
Update info action output and update README.md
Show the value of some relevant environment variables instead of calling
uname, which might show private information like the host name.

Other minor fixes regarding output.
2022-08-02 12:49:09 -05:00
Eric Nielsen a620953556
v1.9.1 2022-05-24 16:25:32 -05:00
Eric Nielsen 5bcfb8cc9f
Override repository options along zmodule calls
for the same module name. Other minor fixes:
* Show skipping already installed modules with install action and `-v`.
* Consider external module dirs when calling compile action directly, by
  making sure _zimfw_source_zimrc is called first.
* Ignore return value from `zargs` with `-P`, as it's oddly returning
  123 since Zsh 5.9. Maybe related to these changes:
  67f932e7c5
2022-05-17 18:43:59 -05:00
Eric Nielsen d6b4aa6ff4
v1.9.0 2022-05-09 18:36:03 -05:00
Eric Nielsen 741bb78a04
Add `--on-pull` option to `zmodule`
Fixes #456
2022-05-07 16:31:08 -05:00
Eric Nielsen 4fe7c66e07
v1.8.0 2022-01-25 17:19:34 -05:00
Eric Nielsen 27dcd4832e
Add `--no-submodules` option to `zmodule`
Fixes #409
2022-01-25 09:32:50 -05:00
Eric Nielsen 016e498bd6
Also work when _zim_fpath is not set
when doing `zimfw check-dumpfile`, otherwise it won't work until init.zsh
is rebuilt, because it's a newly introduced variable.
2022-01-24 18:58:28 -05:00
Eric Nielsen ac2843d8c8
Simplify check-dumpfile to do the same as compinit
first because simpler is usually better, and second because we cannot
always guarantee that the .latest_comp file, which was holding the list
of all completion functions, is consistently in sync with the dumpfile
that is generated afterwards.
2022-01-18 20:51:11 -05:00
Eric Nielsen 35e1d2ea48
Add check-dumpfile action
that removes the dumpfile if it's outdated, so it will get dumped again
when the shell starts next time. We're not using comdump because wrapped
ZLE widgets cannot or should not be identified by compdump when they
have a different name than the original one.
See https://github.com/zsh-users/zsh-syntax-highlighting/issues/851
2022-01-18 20:34:36 -05:00
Eric Nielsen afd35f6590
v1.7.0 2022-01-11 22:51:06 -05:00
Eric Nielsen 92bfa96993
Further clean up and simplify code
@startup_files_glob is not used anymore.
2022-01-11 11:29:47 -05:00
Eric Nielsen 2491856a7b
Clean up and simplify code
No need to set zscriptglob in _zimfw_build_login_init anymore.
Use _zimfw_print in _zimfw_compile.
And other minor simplifications.
2022-01-10 20:41:50 -05:00
Eric Nielsen cfc955c9fd
Deprecate compile in background via login_init.zsh
Changes are:
  * Don't compile in the background anymore, only via the `zimfw` tool
    after actions where scripts can change (build, install, update)
  * Move compilation of the completion dumpfile to the completion module:
    9386a76eac/init.zsh (L10-L11)
  * Don't compile users startup scripts anymore (.zshenv, .zshrc, etc.)
  * Make output of `zimfw init` friendlier for the terminal startup
    screen when called without `-q`.

See https://github.com/romkatv/zsh-bench/pull/11#issuecomment-994979683
and https://github.com/romkatv/zsh-bench#cutting-corners

Regarding not compiling users startup scripts anymore, I'm choosing to
only compile the modules' scripts at least for the reason that compile
won't happen so ofter anymore -- it will only happen when the user calls
the `zimfw` build, install or update actions. So it makes more sense to
only compile the files that `zimfw` has control over changes...

Closes #450
2022-01-10 09:29:32 -05:00
Eric Nielsen 90de91ab4f
v1.6.2 2021-11-21 14:41:25 -05:00
Eric Nielsen a5fb148ccf
Force local zsh emulation options
so the code is not broken by unexpected option changes, like

    setopt RC_EXPAND_PARAM

which breaks

    print -R 'fpath=('${${_zfpaths#${~zpre}}:A}' ${fpath})'

in the _zimfw_build_init function, for example.

See #444.
2021-11-21 14:39:20 -05:00
Eric Nielsen de685e8ef3
Minor text updates in warnings, errors, and usages 2021-11-15 19:37:40 -05:00
Eric Nielsen e060934a9e
.git can be either a directory or a file
Git submodules usually have .git as file, actually. Zim modules should
not be git submodules, but we don't want Zim to be too smart here either.
See https://git-scm.com/docs/gitrepository-layout#_description
2021-11-11 13:46:28 -05:00
Eric Nielsen cd71c8d228
Use git -C instead of changing to the module dir
when doing update using the git tool.
2021-11-10 22:50:17 -05:00
Eric Nielsen ab613bf398
Narrow zmodule help text again
to avoid the horizontal scroll in the https://github.com/zimfw/zimfw
GitHub homepage, as GitHub made the width of the pre block further
narrower. (It's 94 characters now, was 97 before)
2021-11-08 20:05:32 -05:00
Eric Nielsen 503f2daf4c
v1.6.1 2021-11-08 12:03:49 -05:00
Eric Nielsen 811616cc60
Add missing `-l` in git tool print_okay
This fixes a regression introduced in commit b1edcf34d0.

Also don't use any option after `-R` just to be safe. The zshbuiltins(1)
manual states:

> Only the -e and -n flags are recognized after -R; all other arguments
> and options are printed.
2021-11-08 11:38:56 -05:00
Eric Nielsen d7229bb6bc
v1.6.0 2021-11-06 17:04:47 -05:00
Eric Nielsen 4259e64d22
Update init action to also install new modules
so users don't get a "Not installed" error when they add a new module to
.zimrc and forget to run `zimfw install` after that.

See #440
2021-10-26 11:15:40 -05:00
Eric Nielsen a86f69a2f1
Warn when module isn't installed with current tool
instead of showing it as an error. This change allow the message to be
omitted with `-q`.
2021-10-19 08:36:51 -05:00
Eric Nielsen de7d2b131f
More verbose output in install and update actions
listing modules that are frozen or exernal.

Also be less colorful. And some other minor fixes: allow autoloading a
function name that starts with `-`, and add required quotes around
command subsitution (otherwise words are split).
2021-09-29 21:22:28 -05:00
Eric Nielsen 1d5c0c18d1
Initalization options are all auto or all manual
in `zmodule`, since there's no way to unset a default value to "nothing".
2021-09-26 19:47:44 -05:00
Eric Nielsen b1edcf34d0
Use `print -l` to print multiple lines
and also remove extra quotes. Still only leave redundant quotes in

    zstyle -s 'context' style 'name'

as that's kind of a convention already.
2021-09-23 14:29:40 -05:00
Eric Nielsen 6ca4690edc
Further improve handling of external modules
Fix computing the list of unused modules by using the full `_zdirs`
instead of just the `_zmodules` names. The fixed code was even simpler
and cleaner, which makes it even more satisfying.  :- )

Show "not found" instead of "not installed" error when an external
module dir does not exist, since we don't install external modules.
2021-09-23 11:44:31 -05:00
Eric Nielsen 92e6d6b74b
Don't output warnings in quiet mode
For sake of simplicity, and also to distinguish warnings from errors.
So now we have:
  * errors: output to stderr, are **not** silenced with `-q`
  * warnings: output to stderr, are silenced with `-q`
  * info: output to stdout, are silenced with `-q`
  * solicited output (like help, info, or list): output to stdout, does
    not make sense to be silenced with `-q`

We also only have warning in 3 situations so far...  :- )
2021-09-21 16:47:04 -05:00
Eric Nielsen 9a67adfe3b
Update zimfw help text to be more detailed
and add more comments to the code to also hopefully make it clearer.
2021-09-21 08:27:56 -05:00
Eric Nielsen 7deda9c7f4
Show a more informative error when running zmodule
from the shell. This means getting

    zmodule: Must be called from ${ZDOTDIR:-${HOME}}/.zimrc

and the full zmodule usage, instead of getting

    zsh: command not found: zmodule

Fixes #430
2021-09-20 21:21:27 -05:00
Eric Nielsen e097e6bf71
Add list action, don't run tool on external module
Using the `list` action with `-v` shows all current details for the
existing modules.
Don't try to install or update external modules, since they have an
absolute path instead of a valid URL.
2021-09-19 13:37:13 -05:00
Eric Nielsen 476bb6b320
Fix warning when WARN_CREATE_GLOBAL is set
and ZIM_HOME is not. It can be reproduced with:

    unset ZIM_HOME
    setopt WARN_CREATE_GLOBAL
    zimfw info

and the warning is:

    zimfw.zsh:33: scalar parameter ZIM_HOME created globally in function zimfw
2021-08-31 18:42:30 -05:00
Eric Nielsen df70a1ca99
Fix update with git tool when module dir is under
an unresolved symlink.
2021-08-26 18:15:39 -05:00
Eric Nielsen 3bbddf2a23
Update zmodule help message 2021-08-25 16:12:48 -05:00
Eric Nielsen c51898fef0
v1.5.0 2021-08-10 09:56:25 -05:00
Eric Nielsen 35cd6f5f23
Be careful with multiple variables in the same line
as one cannot depend on the other.
2021-08-09 22:28:13 -05:00
Eric Nielsen f6b623f515
Do git clone with `core.autocrlf=false`
to override any `core.autocrlf=true` the user could have set globally.
Fixes #404
2021-08-09 20:32:32 -05:00
Eric Nielsen 7d43589843
Add zstyle to set default zmodule tool
and also simplify code by setting multiple variables at once. This
should make the resulting script a tiny bit smaller, while not
compromising on legibility.
2021-07-11 15:58:15 -05:00
Eric Nielsen 2c8f8e348e
Update help and error messages
and bring back the help message for -z|--frozen that was deleted
accidentally.
2021-07-01 18:08:25 -05:00
Eric Nielsen 5db2b66052
Allow uninstalling modules with custom names
that have a slash, as that yields subdirectories. For example:

    zmodule duration-info -n zimfw/duration-info
    zmodule git-info -n zimfw/git-info
    zmodule asciiship -n zimfw/asciiship
2021-06-17 20:05:01 -05:00
Eric Nielsen 7d533fcecd
Add diff to degit
so we show at least some change log. Not the same as a git log, and I
hope this is good info for users.
2021-04-23 19:15:20 -05:00
Eric Nielsen 89d6f7b7f3
Rename .zim_degit_info to .zdegit
Nicer and way simpler!
2021-04-21 19:37:47 -05:00
Eric Nielsen 2869851379
Fix degit update
Had to remove ${DIR} before renaming ${dir_new} to ${DIR}.

Also also add ${REV} to the info file, in case we need it in the future,
when extracting Zim's degit as a standalone tool for example.
2021-04-08 16:28:47 -05:00
Eric Nielsen cffd456556
Add new degit tool \o/
and rename previous to git.

Tools allow for different install and update scripts. The git tool does
what the previous implementation did (installs and updates using the git
client). The new tool installs and updates with the GitHub API, not
using the git client, but using curl/wget and tar instead.

Closes #373
2021-04-07 17:54:47 -05:00
Eric Nielsen b4b9829360
v1.4.3 2021-03-19 18:44:53 -05:00
Eric Nielsen 163d36b61b
Use Zsh scripting instead of sed, sort and tail
`foo | sed 's?^.*/v??' | sort -n -t. -k1,1 -k2,2 -k3,3 | tail -n1` is
the same as `${${(On)${(f)"$(foo)"}##*v}[1]}`. We don't want to depend
on external tools that might not be available in all platforms.
2021-03-19 18:14:31 -05:00
Eric Nielsen 65783e61ed
Use 2 as exit code for usage errors
See https://tldp.org/LDP/abs/html/exitcodes.html
2021-03-19 17:13:21 -05:00