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

Link from source to unknown path #285

Open
typkrft opened this issue Jul 27, 2021 · 4 comments
Open

Link from source to unknown path #285

typkrft opened this issue Jul 27, 2021 · 4 comments

Comments

@typkrft
Copy link

typkrft commented Jul 27, 2021

Sorry, it's very possible I'm not understanding something. My understanding is that the glob feature just applies to the source not the destination being linked to. Maybe a script of some kind would work.

In macOS the Firefox userChrome.css is in $HOME/Library/Application\ Support/Firefox/Profiles/*/chrome/userChrome.css. This folder varies I believe and this would be useful for a couple of reasons:

  1. to obviously get the path
  2. the ability to link the userChrome.css to multiple profiles simultaneously.

Inside of the Profiles directory are 3 directories for me2j7r4oqe.default efhnzow1.default-release v775fdai.default-nightly

@anishathalye
Copy link
Owner

Yes, you are right, the glob just applies to the source, not the destination. I'm not sure what the semantics should be if globs were to be supported in the destination. How often does this come up, where the exact destination path is unknown? And in such situations, does one usually want the file linked to a particular matching path, or all matching paths?

@typkrft
Copy link
Author

typkrft commented Jul 28, 2021

Hey thanks for the response. Great program by the way!

I wouldn't say it comes up often, but I do know that customizing Firefox userChrome is pretty common. MacOS seems to do a few things in non standard ways too. It might be useful for people who work with Selenium, where users have a number of profiles. Or if there a number of different versions of a program you are working with.

There are ways around this specific problem I'm having, but its pretty messy. Basically I have to delete all the profiles with a shell command or do some complex awk/sed work, regenerate the profile.ini with an echo command, open the browser, kill the browser, move the profile with another shell command, then I can link the files needed. Where just using shell expansion would completely resolve this. I don't know the inner workings of yaml or how this program parses it but maybe an extra parameter that either lets you define the path as it would be expanded to in sh would work. Or expansion: true. It could be useful doing all or targeting specifics. But using shell expansion would allow for either of these scenarios reasonably well.

If I had to work out some logic I would I was say run ls $DESTINATION_PATH_FROM_YAML separate the output in to an array, show the User the output, just in case there's something they aren't expecting, ask for confirmation, or do a count down, then run the command as you normally do for each path. But I'm also a novice, there's probably better logic or ways to do this.

Then you can do something like

-link:
    file: userChrome.css
    - shell_path: ~/Library/Application\ Support/Firefox/Profiles/*.default/chrome

@ldorigo
Copy link

ldorigo commented Jul 30, 2021

Just adding my voice to this request - with a very similar usecase: I want to sync my e-mail filters in thunderbird (which shares most of the structure of firefox), and exactly like @typkrft describes, the filters are also inside a profile that includes a machine-generated name that is different on each computer.

An alternative way to solve this would be to be able to define variables in the yaml file - so I could do something like

profile=( ~/.thunderbird/*.default-release )

and then:

- link: 
  $profile/filters: thunderbird/filters

@erwin
Copy link

erwin commented Oct 13, 2021

As @typkrft mentioned, I would like to use this for userChrome.css with dotbot.

Also, KDE Connnect has a similar format...

/.config/kdeconnect/<device ID in hex>/kdeconnect_runcommand/config

In my dotbot config, I would like to write:

link:
  /.config/kdeconnect/*/kdeconnect_runcommand/config
    path: kdeconnect
    glob: true

And have this glob expanded like with shell globbing. You could apply the "glob: true" flag to both dest and path.

Just a second example of where globbing on the DESTINATION would be useful.

As @ldorigo commented, setting a variable at the top of our YAML config would also be useful, though it still doesn't entirely solve target globbing as we may want to link to multiple destination files... For example, maybe we have multiple chrome profiles that we would like to share the same userChrome.css or in the KDE connect example, maybe we have multiple devices that will change over time, and we would like them to share the same configuration.

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

4 participants