Option for `.chezmoiexternal` to add files directly to target and not in source state
rafamadriz opened this issue · comments
Is your feature request related to a problem? Please describe.
By default chezmoi adds files from .chezmoiexternal
to it's source state, however this is not always
ideal.
Example:
You want to add a themes repo for your terminal.
[".config/kitty"]
type = "archive"
url = "https://github.com/kovidgoyal/kitty-themes/archive/master.tar.gz"
stripComponents = 1
- In this case it will add more than 300 files to chezmoi source state.
- This will add all those files to your git repo, really not ideal, specially if we're talking about more than 300 files.
- It will pollute almost every single action with chezmoi (e.g
edit
) with hundreds of files I really don't care about (in the sense that I don't want them to be added to chezmoi source state). If you use a fuzzy finder like fzf, then using it inside chezmoi source state is going to be a bit annoying because of all those suggested files when searching for anything.
Why not just a script ?
.chezmoiexternal
is actually really simple and easy to use for adding external stuff like plugins for your shell, themes, etc. With features that can be hard to replicate with a script like encrypted
, refreshPeriod
, etc.
Describe the solution you'd like
Option for .chezmoiexternal
to add files as not managed by chezmoi, meaning just clone, download or whatever into target.
Something like:
[".config/kitty"]
type = "archive"
url = "https://github.com/kovidgoyal/kitty-themes/archive/master.tar.gz"
stripComponents = 1
++ unmanaged = true
Describe alternatives you've considered
Shell script. But you lose some of the niceties of chezmoi.
Additional context
By default chezmoi adds files from
.chezmoiexternal
to it's source state...
...
- In this case it will add more than 300 files to chezmoi source state.
- This will add all those files to your git repo
This is not correct. The only file that exists in the source state on disk/in the repo is .chezmoiexternal.$FORMAT
❯ chezmoi managed
.config
.config
.config/kitty
.config/kitty/.all-contributorsrc
.config/kitty/.github
.config/kitty/.github/ISSUE_TEMPLATE
.config/kitty/.github/ISSUE_TEMPLATE/theme-request.md
.config/kitty/.github/PULL_REQUEST_TEMPLATE
.config/kitty/.github/PULL_REQUEST_TEMPLATE/theme-request.md
.config/kitty/.github/kitty-themes.jpg
.config/kitty/LICENSE
.config/kitty/README.rst
.config/kitty/gen-metadata.py
.config/kitty/screenshot.png
.config/kitty/template.conf
.config/kitty/themes
.config/kitty/themes.json
.config/kitty/themes/1984_dark.conf
.config/kitty/themes/1984_light.conf
.config/kitty/themes/1984_orwellian.conf
.config/kitty/themes/3024_Day.conf
.config/kitty/themes/3024_Night.conf
.config/kitty/themes/Adapta_Nokto_Maia.conf
.config/kitty/themes/AdventureTime.conf
.config/kitty/themes/Afterglow.conf
.config/kitty/themes/Alabaster.conf
.config/kitty/themes/Alabaster_Dark.conf
.config/kitty/themes/AlienBlood.conf
.config/kitty/themes/Alucard.conf
.config/kitty/themes/Apprentice.conf
.config/kitty/themes/Aquarium_Dark.conf
.config/kitty/themes/Aquarium_Light.conf
.config/kitty/themes/Argonaut.conf
.config/kitty/themes/Arthur.conf
.config/kitty/themes/AtelierSulphurpool.conf
.config/kitty/themes/Atom.conf
.config/kitty/themes/AtomOneLight.conf
.config/kitty/themes/Batman.conf
.config/kitty/themes/Belafonte_Day.conf
.config/kitty/themes/Belafonte_Night.conf
.config/kitty/themes/BirdsOfParadise.conf
.config/kitty/themes/BlackMetal.conf
.config/kitty/themes/Blazer.conf
.config/kitty/themes/BlulocoDark.conf
.config/kitty/themes/BlulocoLight.conf
.config/kitty/themes/Borland.conf
.config/kitty/themes/Box.conf
.config/kitty/themes/Bright_Lights.conf
.config/kitty/themes/Broadcast.conf
.config/kitty/themes/Brogrammer.conf
.config/kitty/themes/C64.conf
.config/kitty/themes/CLRS.conf
.config/kitty/themes/Campbell.conf
.config/kitty/themes/Catppuccin-Frappe.conf
.config/kitty/themes/Catppuccin-Latte.conf
.config/kitty/themes/Catppuccin-Macchiato.conf
.config/kitty/themes/Catppuccin-Mocha.conf
.config/kitty/themes/Chalk.conf
.config/kitty/themes/Chalkboard.conf
.config/kitty/themes/ChallengerDeep.conf
.config/kitty/themes/Ciapre.conf
.config/kitty/themes/Cobalt2.conf
.config/kitty/themes/Cobalt_Neon.conf
.config/kitty/themes/Constant_Perceptual_Luminosity_dark.conf
.config/kitty/themes/Corvine.conf
.config/kitty/themes/CrayonPonyFish.conf
.config/kitty/themes/Cyberpunk-Neon.conf
.config/kitty/themes/DarkOneNuanced.conf
.config/kitty/themes/Dark_Pastel.conf
.config/kitty/themes/Darkside.conf
.config/kitty/themes/Desert.conf
.config/kitty/themes/DesertNight.conf
.config/kitty/themes/DimmedMonokai.conf
.config/kitty/themes/Doom_One.conf
.config/kitty/themes/Doom_One_Light.conf
.config/kitty/themes/Doom_Vibrant.conf
.config/kitty/themes/DotGov.conf
.config/kitty/themes/Dracula.conf
.config/kitty/themes/Dumbledore.conf
.config/kitty/themes/Duotone_Dark.conf
.config/kitty/themes/ENCOM.conf
.config/kitty/themes/Earthsong.conf
.config/kitty/themes/Eldritch.conf
.config/kitty/themes/Elemental.conf
.config/kitty/themes/Espresso.conf
.config/kitty/themes/Espresso_Libre.conf
.config/kitty/themes/Falcon.conf
.config/kitty/themes/Farin.conf
.config/kitty/themes/Fideloper.conf
.config/kitty/themes/FishTank.conf
.config/kitty/themes/Flat.conf
.config/kitty/themes/Flatland.conf
.config/kitty/themes/Floraverse.conf
.config/kitty/themes/ForestNight.conf
.config/kitty/themes/FrontEndDelight.conf
.config/kitty/themes/FunForrest.conf
.config/kitty/themes/Galaxy.conf
.config/kitty/themes/GitHub_Dark.conf
.config/kitty/themes/GitHub_Dark_Colorblind.conf
.config/kitty/themes/GitHub_Dark_Dimmed.conf
.config/kitty/themes/GitHub_Dark_High_Contrast.conf
.config/kitty/themes/GitHub_Light.conf
.config/kitty/themes/GitHub_Light_Colorblind.conf
.config/kitty/themes/GitHub_Light_High_Contrast.conf
.config/kitty/themes/Github.conf
.config/kitty/themes/Glacier.conf
.config/kitty/themes/GoaBase.conf
.config/kitty/themes/Grape.conf
.config/kitty/themes/Grass.conf
.config/kitty/themes/GruvboxMaterialDarkHard.conf
.config/kitty/themes/GruvboxMaterialDarkMedium.conf
.config/kitty/themes/GruvboxMaterialDarkSoft.conf
.config/kitty/themes/GruvboxMaterialLightHard.conf
.config/kitty/themes/GruvboxMaterialLightMedium.conf
.config/kitty/themes/GruvboxMaterialLightSoft.conf
.config/kitty/themes/HachikoRed.conf
.config/kitty/themes/Hardcore.conf
.config/kitty/themes/Harper.conf
.config/kitty/themes/Highway.conf
.config/kitty/themes/Hipster_Green.conf
.config/kitty/themes/Homebrew.conf
.config/kitty/themes/Hurtado.conf
.config/kitty/themes/Hybrid.conf
.config/kitty/themes/IC_Green_PPL.conf
.config/kitty/themes/IC_Orange_PPL.conf
.config/kitty/themes/IR_Black.conf
.config/kitty/themes/Jackie_Brown.conf
.config/kitty/themes/Japanesque.conf
.config/kitty/themes/Jellybeans.conf
.config/kitty/themes/JetBrains_Darcula.conf
.config/kitty/themes/Kaolin_Aurora.conf
.config/kitty/themes/Kaolin_Breeze.conf
.config/kitty/themes/Kaolin_Dark.conf
.config/kitty/themes/Kaolin_Galaxy.conf
.config/kitty/themes/Kaolin_Light.conf
.config/kitty/themes/Kaolin_Ocean.conf
.config/kitty/themes/Kaolin_Temple.conf
.config/kitty/themes/Kibble.conf
.config/kitty/themes/Later_This_Evening.conf
.config/kitty/themes/Lavandula.conf
.config/kitty/themes/LiquidCarbon.conf
.config/kitty/themes/LiquidCarbonTransparent.conf
.config/kitty/themes/LiquidCarbonTransparentInverse.conf
.config/kitty/themes/Man_Page.conf
.config/kitty/themes/Material.conf
.config/kitty/themes/MaterialDark.conf
.config/kitty/themes/Mathias.conf
.config/kitty/themes/Medallion.conf
.config/kitty/themes/Misterioso.conf
.config/kitty/themes/Modus_Operandi.conf
.config/kitty/themes/Modus_Operandi_Tinted.conf
.config/kitty/themes/Modus_Vivendi.conf
.config/kitty/themes/Modus_Vivendi_Tinted.conf
.config/kitty/themes/Molokai.conf
.config/kitty/themes/MonaLisa.conf
.config/kitty/themes/Monoindustrial.conf
.config/kitty/themes/Monokai.conf
.config/kitty/themes/Monokai_Classic.conf
.config/kitty/themes/Monokai_Pro.conf
.config/kitty/themes/Monokai_Pro_(Filter_Machine).conf
.config/kitty/themes/Monokai_Pro_(Filter_Octagon).conf
.config/kitty/themes/Monokai_Pro_(Filter_Ristretto).conf
.config/kitty/themes/Monokai_Pro_(Filter_Spectrum).conf
.config/kitty/themes/Monokai_Soda.conf
.config/kitty/themes/N0tch2k.conf
.config/kitty/themes/Neopolitan.conf
.config/kitty/themes/Neowave.conf
.config/kitty/themes/Neutron.conf
.config/kitty/themes/NightLion_v1.conf
.config/kitty/themes/NightLion_v2.conf
.config/kitty/themes/Nightfox.conf
.config/kitty/themes/Nord.conf
.config/kitty/themes/Nova.conf
.config/kitty/themes/Novel.conf
.config/kitty/themes/Obsidian.conf
.config/kitty/themes/Ocean.conf
.config/kitty/themes/OceanicMaterial.conf
.config/kitty/themes/Ollie.conf
.config/kitty/themes/OneDark.conf
.config/kitty/themes/OneHalfDark.conf
.config/kitty/themes/OneHalfLight.conf
.config/kitty/themes/PaperColor_dark.conf
.config/kitty/themes/PaperColor_light.conf
.config/kitty/themes/Parasio_Dark.conf
.config/kitty/themes/PaulMillr.conf
.config/kitty/themes/PencilDark.conf
.config/kitty/themes/PencilLight.conf
.config/kitty/themes/Piatto_Light.conf
.config/kitty/themes/Pnevma.conf
.config/kitty/themes/Pro.conf
.config/kitty/themes/Red_Alert.conf
.config/kitty/themes/Red_Sands.conf
.config/kitty/themes/Relaxed_Afterglow.conf
.config/kitty/themes/Renault_Style.conf
.config/kitty/themes/Renault_Style_Light.conf
.config/kitty/themes/Rippedcasts.conf
.config/kitty/themes/Royal.conf
.config/kitty/themes/Sakura_Night.conf
.config/kitty/themes/SeaShells.conf
.config/kitty/themes/Seafoam_Pastel.conf
.config/kitty/themes/Seti.conf
.config/kitty/themes/Shaman.conf
.config/kitty/themes/Sierra.conf
.config/kitty/themes/Slate.conf
.config/kitty/themes/Smyck.conf
.config/kitty/themes/SnowDark.conf
.config/kitty/themes/SnowLight.conf
.config/kitty/themes/SoftServer.conf
.config/kitty/themes/Solarized8_Dark.conf
.config/kitty/themes/Solarized_Darcula.conf
.config/kitty/themes/Solarized_Dark.conf
.config/kitty/themes/Solarized_Dark_-_Patched.conf
.config/kitty/themes/Solarized_Dark_Higher_Contrast.conf
.config/kitty/themes/Solarized_Light.conf
.config/kitty/themes/Source_Code_X.conf
.config/kitty/themes/Sourcerer.conf
.config/kitty/themes/SpaceGray.conf
.config/kitty/themes/SpaceGray_Eighties.conf
.config/kitty/themes/SpaceGray_Eighties_Dull.conf
.config/kitty/themes/Spacedust.conf
.config/kitty/themes/Spacemacs.conf
.config/kitty/themes/Spiderman.conf
.config/kitty/themes/Spring.conf
.config/kitty/themes/Square.conf
.config/kitty/themes/Srcery.conf
.config/kitty/themes/Substrata.conf
.config/kitty/themes/Sundried.conf
.config/kitty/themes/Symfonic.conf
.config/kitty/themes/Tango_Dark.conf
.config/kitty/themes/Tango_Light.conf
.config/kitty/themes/Teerb.conf
.config/kitty/themes/Thayer_Bright.conf
.config/kitty/themes/The_Hulk.conf
.config/kitty/themes/Tomorrow.conf
.config/kitty/themes/Tomorrow_Night.conf
.config/kitty/themes/Tomorrow_Night_Blue.conf
.config/kitty/themes/Tomorrow_Night_Bright.conf
.config/kitty/themes/Tomorrow_Night_Eighties.conf
.config/kitty/themes/ToyChest.conf
.config/kitty/themes/Treehouse.conf
.config/kitty/themes/Twilight.conf
.config/kitty/themes/Ubuntu.conf
.config/kitty/themes/Urple.conf
.config/kitty/themes/VSCode_Dark.conf
.config/kitty/themes/Vaughn.conf
.config/kitty/themes/VibrantInk.conf
.config/kitty/themes/WarmNeon.conf
.config/kitty/themes/Wez.conf
.config/kitty/themes/WildCherry.conf
.config/kitty/themes/Wombat.conf
.config/kitty/themes/Wryan.conf
.config/kitty/themes/YsDark.conf
.config/kitty/themes/Zenburn.conf
.config/kitty/themes/adwaita_dark.conf
.config/kitty/themes/adwaita_darker.conf
.config/kitty/themes/adwaita_light.conf
.config/kitty/themes/ayu.conf
.config/kitty/themes/ayu_light.conf
.config/kitty/themes/ayu_mirage.conf
.config/kitty/themes/breath2.conf
.config/kitty/themes/cherry-midnight.conf
.config/kitty/themes/cherry.conf
.config/kitty/themes/citylights.conf
.config/kitty/themes/cyberpunk.conf
.config/kitty/themes/dark_pride.conf
.config/kitty/themes/default.conf
.config/kitty/themes/duckbones.conf
.config/kitty/themes/everforest_dark_hard.conf
.config/kitty/themes/everforest_dark_medium.conf
.config/kitty/themes/everforest_dark_soft.conf
.config/kitty/themes/everforest_light_hard.conf
.config/kitty/themes/everforest_light_medium.conf
.config/kitty/themes/everforest_light_soft.conf
.config/kitty/themes/fairyfloss.conf
.config/kitty/themes/flexoki_dark.conf
.config/kitty/themes/flexoki_light.conf
.config/kitty/themes/gruvbox-dark-hard.conf
.config/kitty/themes/gruvbox-dark-soft.conf
.config/kitty/themes/gruvbox-dark.conf
.config/kitty/themes/gruvbox-light-hard.conf
.config/kitty/themes/gruvbox-light-soft.conf
.config/kitty/themes/gruvbox-light.conf
.config/kitty/themes/h_pux.conf
.config/kitty/themes/idleToes.conf
.config/kitty/themes/kanagawa.conf
.config/kitty/themes/kanagawa_dragon.conf
.config/kitty/themes/kanagawa_light.conf
.config/kitty/themes/kanagawabones.conf
.config/kitty/themes/kurayami.conf
.config/kitty/themes/leaf_dark.conf
.config/kitty/themes/leaf_light.conf
.config/kitty/themes/mayukai.conf
.config/kitty/themes/midsummer-night.conf
.config/kitty/themes/mishran.conf
.config/kitty/themes/moonlight.conf
.config/kitty/themes/neobones_dark.conf
.config/kitty/themes/neobones_light.conf
.config/kitty/themes/night_owl.conf
.config/kitty/themes/nightfly.conf
.config/kitty/themes/noirblaze.conf
.config/kitty/themes/outrun_electric.conf
.config/kitty/themes/purpurite.conf
.config/kitty/themes/rose-pine-dawn.conf
.config/kitty/themes/rose-pine-moon.conf
.config/kitty/themes/rose-pine.conf
.config/kitty/themes/seoulbones_dark.conf
.config/kitty/themes/seoulbones_light.conf
.config/kitty/themes/shadotheme.conf
.config/kitty/themes/snazzy.conf
.config/kitty/themes/tokyo_night_day.conf
.config/kitty/themes/tokyo_night_moon.conf
.config/kitty/themes/tokyo_night_night.conf
.config/kitty/themes/tokyo_night_storm.conf
.config/kitty/themes/vimbones.conf
.config/kitty/themes/wizzy-bright.conf
.config/kitty/themes/wizzy-muted.conf
.config/kitty/themes/xcodedark.conf
.config/kitty/themes/zenbones_dark.conf
.config/kitty/themes/zenbones_light.conf
.config/kitty/themes/zenburned.conf
.config/kitty/themes/zenwritten_dark.conf
.config/kitty/themes/zenwritten_light.conf
hello world.txt
❯ chezmoi apply
❯ tre -a --exclude .git .local/share/chezmoi
.local/share/chezmoi
├── .chezmoiexternal.toml
└── hello world.txt
It will pollute almost every single action with chezmoi (e.g
edit
) with hundreds of files I really don't care about
The diff
, status
and verify
config sections have an exclude
option, which can be used to exclude externals.
-x
/--exclude
can also be passed to many commands to exclude externals.
❯ chezmoi managed -x externals
hello world.txt
This is not correct. The only file that exists in the source state on disk/in the repo is .chezmoiexternal.$FORMAT
@bradenhilton Oh you're right, now that makes more sense, I was confused between managed
and what is actually on the repo. Even with your example it took me a moment, I feel so dumb haha
The diff, status and verify config sections have an exclude option, which can be used to exclude externals.
-x/--exclude can also be passed to many commands to exclude externals.
❯ chezmoi managed -x externals hello world.txt
Thank you for that, I actually already use -x
for one of my scripts, I guess I didn't notice the external
option which helps me with point 3
You can see the available types in the include section