freshshell / fresh

Keep your dotfiles fresh.
https://freshshell.com/
1.18k stars 87 forks source link

Make globbing with --bin possible #150

Open ajsalminen opened 7 years ago

ajsalminen commented 7 years ago

Currently this seems to work for linking a bunch of files into a directory:

fresh mutt/\* --file=.mutt/

It would be nice to be able to do the same with bin and avoid naming each individual script in freshrc. fresh bin/\* --bin=bin/

jasoncodes commented 6 years ago

Globbing to directory targets are currently not supported features for either --file or --bin. This is something I would like fresh to support at some point so thanks for feature request. You can work around this limitation right now by writing a loop in your freshrc:

for FILE in "$FRESH_LOCAL/mutt/"*; do
  fresh "mutt/$(basename "$FILE")" --file=".mutt/$(basename "$FILE")"
done

I noticed you are using relative target paths in both your examples. A relative path on --file writes into ~/.fresh/build without linking the built files out to your home directory. Is this what you are intending to do? I want to confirm whether you expect the above examples to write to ~/.mutt/ and ~/bin or not. If this is what you are expecting, ~/ will need to be prepending to the target paths.

Also, --bin with a relative path should currently be failing with an “--bin file paths cannot be relative” error message whether or not you have a glob in the source path. This is something we can look into supporting if this would be a valuable feature to you. Right now though you could work around this using a fresh_after_build callback to chmod +x the appropriate files in ~/.fresh/build.