Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add link to hstow #43

Open
spwhitton opened this issue Nov 12, 2022 · 6 comments
Open

Add link to hstow #43

spwhitton opened this issue Nov 12, 2022 · 6 comments

Comments

@spwhitton
Copy link

Hello,

Thanks for this script. I recently implemented something similar, except it truly has no dependencies other than POSIX sh. Perhaps you'd consider adding a link to my script to the README?

https://git.spwhitton.name/dotfiles/tree/bin/hstow

@mikepqr
Copy link
Owner

mikepqr commented Nov 12, 2022

Looks great! I'm pretty close to archiving stowsh as I find shell pretty much unmaintanable, and I'm happy to see someone else working on this use case!

Couple of questions:

  • why do you link the package to a directory under ~/.STOW, and then link to that link? Why the indirection? Why not just link to the package?
  • assuming there's a good reason for the previous question, would you consider changing ~/.STOW to something more consistent with the XDG spec, e.g. ~/local/share/stow?
  • I couldn't get unstow to work:
$ ./hstow stow package/
$ ./hstow unstow package/
cut: [-bcf] list: values may not include zero

@spwhitton
Copy link
Author

* why do you link the package to a directory under `~/.STOW`, and then link to that link? Why the indirection? Why not just link to the package?

I was previously using a wrapper for GNU Stow, written by the GNU Stow maintainer, which arranged things this way. By using the same scheme I don't have to try to migrate my symlinks on all the hosts I've got my dotfiles checked out on. Independently, I like how it makes it easy to identify the symlinks created by hstow, and means the unstow() routine can be simple.

* assuming there's a good reason for the previous question, would you consider changing `~/.STOW` to something more consistent with the XDG spec, e.g. `~/local/share/stow`?

It's unfortunate an XDG-compatible location wasn't chosen originally. But unfortunately I can't change it now without losing the two advantages noted above.

* I couldn't get `unstow` to work:
$ ./hstow stow package/
$ ./hstow unstow package/
cut: [-bcf] list: values may not include zero

Strange, can you 'set -x' for more info, please?

@mikepqr
Copy link
Owner

mikepqr commented Nov 13, 2022

$ ./hstow unstow package/
++ printf '\n\t'
+ IFS='
	'
+ export LC_ALL=C
+ LC_ALL=C
++ printf '\t'
+ tab='	'
++ printf '*[\001-\037\177]*'
+ cchars='*[-]*'
+ command -v readlink
+ '[' 2 = 2 ']'
+ '[' -d package/ ']'
++ cd package/
++ pwd
+ DIR=/Users/mike/tmp/package
++ echo /Users/mike/tmp/package
+++ echo /Users/mike
+++ wc -c
++ cut -c-11
+ '[' /Users/mike = /Users/mike ']'
++ echo /Users/mike/tmp/package
++ tr / _
+ NAME=_Users_mike_tmp_package
+ always_adopt=false
+ case "$1" in
+ unstow
+ cd /Users/mike
++ echo /Users/mike/tmp/package
+++ echo /Users/mike
+++ wc -c
++ cut '-c      12-'
cut: [-bcf] list: values may not include zero
+ dir_pat='^./'

@spwhitton
Copy link
Author

spwhitton commented Nov 13, 2022 via email

@mikepqr
Copy link
Owner

mikepqr commented Nov 16, 2022

$ ./hstow unstow package/
++ printf '\n\t'
+ IFS='
	'
+ export LC_ALL=C
+ LC_ALL=C
++ printf '\t'
+ tab='	'
++ printf '*[\001-\037\177]*'
+ cchars='*[-]*'
+ command -v readlink
+ '[' 2 = 2 ']'
+ '[' -d package/ ']'
++ cd package/
++ pwd
+ DIR=/Users/mike/tmp/package
++ echo /Users/mike/tmp/package
+++ echo /Users/mike
+++ wc -c
++ cut -c-11
+ '[' /Users/mike = /Users/mike ']'
++ echo /Users/mike/tmp/package
++ tr / _
+ NAME=_Users_mike_tmp_package
+ always_adopt=false
+ case "$1" in
+ unstow
+ cd /Users/mike
++ echo /Users/mike/tmp/package
+++ echo /Users/mike
+++ wc -m
+++ tr -d ' '
++ cut -c12-
+ dir_pat='^./tmp/package/'
++ find . -type l '!' -name . '!' -name '*[-]*'
++ grep -v '^./tmp/package/'

... and then nothing. The process is stuck. No output and I have to ctrl-c to get back a prompt.

@spwhitton
Copy link
Author

spwhitton commented Nov 16, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants