Commit Graph

146 Commits

Author SHA1 Message Date
Eric Nielsen 39d2087ad4
v1.13.0 2024-02-16 21:06:36 -05:00
Eric Nielsen 2e9256a567
Add new mkdir tool to generate empty modules
This will allow creating modules that contain only externally generated
files. For example, this is how I currently use it to generate modules
for code that is supposed to be eval'ed:

    zmodule-eval() {
      local -r zcommand=${${=1}[1]} ztarget=${1//[^[:alnum:]]/-}.zsh
      zmodule custom-${zcommand} --use mkdir --if-command ${zcommand} \
          --cmd "if [[ ! {}/${ztarget} -nt \${commands[${zcommand}]} ]]; then ${1} >! {}/${ztarget}; zcompile -UR {}/${ztarget}; fi" \
          --source ${ztarget}
    }
    zmodule-eval 'starship init zsh'
    unfunction zmodule-eval
2024-02-16 20:41:29 -05:00
Eric Nielsen 8bec2f7549
Add `--if-command` option to `zmodule` 2024-01-22 21:36:17 -05:00
Eric Nielsen 5f649d3031
v1.12.1 2023-09-16 13:26:53 -05:00
Eric Nielsen 26151d2f54
Remove prompt expansion from print statements
and replace the foreground color and bold expansions by ANSI escape
codes. This should make the print calls now safe and no expansion at all
should happen as we're using `-R` -- unless the `-e` flag is given.
Fixes #521. Closes #522
2023-09-16 13:21:14 -05:00
Eric Nielsen d33d632ec1
Use `--sort=-v:refname` in _zimfw_check_version
to sort tags, instead of using Zsh's `(On)`. The tags will come sorted
already.
2023-09-15 19:55:43 -05:00
Eric Nielsen e0d067977c
v1.12.0 2023-07-17 18:55:26 -05:00
Eric Nielsen 49386cad6d
Make forced check-version asynchronous (again)
as it was before a34b8dab64.
Don't make zimfw hang in the foreground waiting for git to connect to
GitHub, mainly because the waiting can take too long in case of
connection issues or no network. Also set git timeout to 30 seconds so
background check also does hang for too long, just it case.

Fixes #514
2023-06-16 20:24:33 -05:00
Eric Nielsen 0566b9b8a3
Use _zimfw_print 2023-06-15 09:33:14 -05:00
alesandar f9648e07a9
Handle module root directories without write permission
Closes #513. Fixes #512
2023-06-15 09:26:37 -05:00
Eric Nielsen f93e43e8a5
Tools run in a subshell 2023-03-31 20:34:26 -05:00
Eric Nielsen 67de6ec25b
Don't resolve symlinks when building init.zsh
So init.zsh is consistent after symlinks change to point to something
else. See zimfw/completion#15
2023-03-30 08:38:12 -05:00
Eric Nielsen ee93f7944f
Don't use a new shell to run tool anymore
This was needed when we were using xargs, but we're already using zargs
instead for quite some time. Pro is that now common functions are reused
instead of repeated. Con (or change) is that due to that reuse, and in
favor of simplification, the warning for a module with git submodules in
degit is in a separate line from a separate print call now.

Also fix regressions from recent commits:
- Need to call _zimfw_source_zimrc twice with 1 and 2 flags instead of
  with flag 3, since flag 2 must be used after module is installed or
  updated.
- Need to call _zimfw_print_okay from the function that handles on-pull,
  since we want to include the on-pull output in verbose mode. This
  function was called just `handle` before, now it's called
  _zimfw_pull_print_okay.

Still need to figure out how to return a final error code from
_zimfw_run_tool_action.
2023-03-28 07:56:37 -05:00
Eric Nielsen 312b08c20a
Fix missing -C in command git 2023-03-26 16:51:24 -05:00
Eric Nielsen 903e0e5249
Add check and rename version-check to check-version
actions. Return 4 if there's a zimfw update from check-version. Don't
return a specific error code if there are module updates from check, as
it uses zargs to check all and each check runs in a separate shell. Need
to figure out how to propagate all that to a final error code.

See #503
2023-03-26 09:34:07 -05:00
Eric Nielsen b7b33f3786
Also output LANG LC_* parameters in info action 2023-03-24 09:46:44 -05:00
Eric Nielsen a34b8dab64
Add version-check action
And don't run the dumping of the .latest_version file in
_zimfw_version_check in the background (with `&!`) anymore.

See #503
2023-03-24 08:44:52 -05:00
Eric Nielsen 222c971542
v1.11.3 2023-02-25 19:44:58 -05:00
Eric Nielsen 6a24459de9
Deprecate check-dumpfile action
The completion module alone will handle checking the dumpfile.
See https://github.com/zimfw/completion/pull/12
2023-02-25 19:03:37 -05:00
Eric Nielsen fff151be09
v1.11.2 2023-02-16 07:59:49 -05:00
Eric Nielsen f71bff5418
Quote path names in init.zsh
to properly handle path names with spaces.
Fixes #497
2023-02-16 07:51:30 -05:00
Eric Nielsen d10d7c627c
Revert "Further improve check-dumpfile action accuracy"
This reverts commit e47eaae2e4.
2023-02-16 07:51:30 -05:00
Eric Nielsen e47eaae2e4
Further improve check-dumpfile action accuracy
Previous change fixed the old dumpfile vs. new dumpfile check, but
removed an existing (but flawled) old Zim fpath vs. new Zim fpath check.
We should be doing both checks the right way now.
2023-02-06 19:19:15 -05:00
Eric Nielsen 05164357b8
v1.11.1 2023-02-04 09:47:19 -05:00
Eric Nielsen a434fda508
More accurate check-dumpfile action
by using the `_zim_dumpfile_fpath` variable set by the completion module
[here](33737e8c15/init.zsh (L11))
right before `compinit` is run.
2023-02-03 18:56:16 -05:00
Eric Nielsen 281cde57f7
v1.11.0 2022-12-18 16:09:04 -05:00
Eric Nielsen e54958b91c
Allow customizing .zimrc file path
with the ZIM_CONFIG_FILE environment variable.
Fixes #479.
2022-10-23 19:34:14 -05:00
Eric Nielsen 3959a7f4e0
Add `--if` option to `zmodule`
Fixes #355
2022-10-06 19:52:57 -05:00
Eric Nielsen 8a9d63c522
Fix quoting string in glob
so it does not get expanded as a glob itself, if it contains special
characters.
2022-09-28 19:42:05 -05:00
Eric Nielsen 238da94b54
v1.10.0 2022-09-27 17:45:16 -05:00
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