1
0
Fork 0
mirror of synced 2024-11-04 15:58:57 -05:00
Commit graph

670 commits

Author SHA1 Message Date
Eric Nielsen
3b7908dca1
Try to upgrade zimfw.zsh if it's a symlink
Initially the idea was to not allow this so upgrades are disabled when
the script is installed using a package manager, but this is an
unnecessary complexity. Making it less smart and more predictable.
2024-06-25 09:08:10 -05:00
Eric Nielsen
0785d87ea4
Improve error messages and check ZIM_HOME
for write permission. Also, if ZIM_HOME is not defined, don't "autoload"
the zimfw function, since this is going to be a scenario where the user
only has something like `source /path/to/zim/init.zsh` in their .zshrc.
2024-06-21 15:43:48 -05:00
Eric Nielsen
eb37844857
Disable background version check if no write access
to zimfw.zsh or if it's a symlink or not a regular file. It does not
make sense to show a message to user saying "Run zimfw upgrade to
upgrade" if the action will then fail.
2024-06-18 17:40:12 -05:00
Eric Nielsen
3e812ed311
Don't upgrade zimfw.zsh if not in a writable path
or if it's a symlink or not a regular file. This makes more sense now
that zimfw.zsh can exist outside ZIM_HOME, that the same file can be
used my multiple users in the same machine, and that it is going to be
possible to install it with a package manager once it's stable to do so.
2024-06-18 17:13:53 -05:00
Eric Nielsen
897afc9cf9
Reapply "Use ${HOME} in generated static init.zsh script"
This reverts commit 9a47fde0c8.
2024-06-17 07:29:19 -05:00
Eric Nielsen
76164d6217
Allow zimfw.zsh to exist outside ZIM_HOME
and change initialization so ZIM_HOME is required before sourcing the
script.
2024-06-14 20:17:07 -05:00
Eric Nielsen
9a47fde0c8
Revert "Use ${HOME} in generated static init.zsh script"
This reverts commit 06f8bc71a3.

This breaks allowing a machine to have just one init.zsh script that can
be sourced by different users.
2024-06-10 07:52:45 -05:00
Eric Nielsen
06f8bc71a3
Use ${HOME} in generated static init.zsh script
Fixes #509
2024-06-09 11:32:08 -05:00
Eric Nielsen
9dc4056c4e
chmod a+r init.zsh so all users can read it
This better allows a global instalation of Zim that can be sourced by
other users in the same machine.

See #486
2024-06-03 08:51:20 -05:00
Eric Nielsen
96f60da366
Improve zimfw's degit error message
Hopefully make it clearer when either the git or the degit tool is being
used.

See #535
2024-05-30 09:38:44 -05:00
Eric Nielsen
cdd9258d5c
Don't expose the zmodule function outside zimfw
Don't want to maintain extra code to allow zmodule to run outside zimfw.
This has no added benefit and might confuse users. If you were calling
zmodule in the shell just to get the help message, hopefully you can
look that up in the documentation instead.
2024-05-30 09:21:16 -05:00
Eric Nielsen
4fcc85b2db
Update README.md with ZIM_CONFIG_FILE instructions
Also add git-info and duration-info modules to the basic templates for a
better user experience.
2024-05-26 12:44:49 -05:00
Eric Nielsen
4200e6cdb3
v1.13.1 2024-04-28 14:07:41 -05:00
Eric Nielsen
c86223f473
Don't use tar --strip
as it's not compatible with BSD distributions.
Fixes #534
2024-04-28 14:06:24 -05:00
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
db96076cf0
fixup! Don't use a new shell to run tool anymore 2023-04-01 08:31:09 -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
7778e9749a
Update LICENSE 2023-02-04 09:46:11 -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
3351dc6dac
Update CHANGELOG.md 2022-09-27 17:50:52 -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
b5703f9e17
Update CHANGELOG.md 2022-05-24 16:29:36 -05:00