Comments (2)
The subdirectory is part of the target path/name. If it wasn't, you could easily run into collisions with identically named files in separate directories. .chezmoiscripts
entries still have a target path despite no file in the destination state being created.
From https://www.chezmoi.io/reference/application-order:
- Run
run_before_
scripts in alphabetical order.- Update entries in the target state (files, directories, externals, scripts, symlinks, etc.) in alphabetical order of their target name. Directories (including those created by externals) are updated before the files they contain.
- Run
run_after_
scripts in alphabetical order.Target names are considered after all attributes are stripped.
chezmoi\home
❯ Get-ChildItem -File -Path @('.\.chezmoiscripts\global\', '.\.chezmoiscripts\darwin\', '.\.chezmoiscripts\linux\') | ForEach-Object { [System.IO.Path]::GetRelativePath((chezmoi target-path), (chezmoi target-path $_)) } | Sort-Object
.chezmoiscripts\darwin\10_setup-install-homebrew.sh
.chezmoiscripts\darwin\20_setup-brew-packages.sh
.chezmoiscripts\global\00_bootstrap_decrypt-age-key.sh
(Note how I deliberately accumulated the source directories in a non-alphabetical order and then finally sorted the target paths relative to the destination directory)
If the script really is global as you mention, consider moving it outside of the subdirectory i.e. .chezmoiscripts/run_before_00_bootstrap_decrypt-age-key.sh.tmpl
:
chezmoi\home
❯ Get-ChildItem -File -Path @('.\.chezmoiscripts\darwin\', '.\.chezmoiscripts\linux\', '.\.chezmoiscripts\') | ForEach-Object { [System.IO.Path]::GetRelativePath((chezmoi target-path), (chezmoi target-path $_)) } | Sort-Object
.chezmoiscripts\00_bootstrap_decrypt-age-key.sh
.chezmoiscripts\darwin\10_setup-install-homebrew.sh
.chezmoiscripts\darwin\20_setup-brew-packages.sh
(Again, note the deliberate incorrect order in which I generate the target paths, before sorting them)
from chezmoi.
Thanks for the clear and excellent explanation @bradenhilton
Target names are considered after all attributes are stripped.
This was the lightbulb moment in the documentation for me.
from chezmoi.
Related Issues (20)
- Speed up release GitHub Action
- Virtual destination (Windows Registry, macOS defaults) for comparison against the source HOT 3
- Supports predefined configuration file paths, shares the fruits of labor, and saves a lot of time! HOT 1
- HCP Vault Secrets integration not recognizing service principal environment variables HOT 4
- chezmoi doesn't like ~ in edit HOT 6
- fromJson regression in 2.42.x (it can no longer unmarshal arrays) HOT 1
- Permission denied when modifying hidden files on Windows HOT 6
- Ignore files when doing chezmoi add? HOT 2
- Implementing Declarative Syntax for Streamlined Package Installation HOT 2
- How can I manage chezmoi configuration with chezmoi? HOT 6
- Support symlinks in mackup command HOT 6
- Wrong hostname in chezmoi data HOT 2
- chezmoiexternals conflict HOT 4
- `chezmoi cd` errors with `chezmoi: already in a chezmoi subshell` when in a different subshell HOT 5
- Chezmoi confused with `exact_` and externals inside it HOT 5
- Unable to call templates in `.chezmoi.toml.tmpl` HOT 5
- `run_onchange_` scripts are not re-executed after `chezmoi state delete-bucket --bucket=scriptState` HOT 4
- Documentation HOT 3
- secret keyring panics, "no annotations"
- rbw: pass additional arguments HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chezmoi.