dvorka / hstr

bash and zsh shell history suggest box - easily view, navigate, search and manage your command history.
http://me.mindforger.com
Apache License 2.0
3.99k stars 232 forks source link

snap: access to dotfiles #316

Open ghost opened 5 years ago

ghost commented 5 years ago

The strict confinement policy blocks access to the .bash_history and .zsh_history file in the $HOME directory. The home interface (plugs subsection) also does not help because it only guarantees access to non-hidden files.

dvorka commented 5 years ago

@fszymanski Thank you for your suggestions, contributions, PRs and your continued support of the project - I really appreciate it!

I guess that you are Snap expert. Therefore I would like to use this opportunity to ask you for help.

As you may noticed, I consolidated sources and distribution names towards the name HSTR, because hh/hstr ambiguity caused problems e.g. project must have unambiguous name before it will be accepted by major distribution(s) maintainers (BTW I agree with making the name consistent).

Therefore I would like to have snap registered for hstr, but I'm not able to fix snapcraft.yaml configuration to make it build. You also sent PR https://github.com/dvorka/hstr/pull/314 which probably fixes snap build, but returns back to hh name (this is why I didn't merged it yet). I have registered both hstr and hh on snapcraft.io, but I would like to go with hstr. The problem is that I'm not able to convince snapcraft to pick hstr (and ignore hh) in bin/ directory (while building). The tool keeps to pick hh regardles there is no hh in snapcraft.yaml. Perhaps the problem might be that automake-based build creates hstr in bin/ directory + symlink hh to hstr. Does it make sense? Can I choose which binary to pick? Can I delete symlink as a part of snapcraft build?

Thank you in advance for any suggestion!

ghost commented 5 years ago

I guess that you are Snap expert. Therefore I would like to use this opportunity to ask you for help.

I'm hardly an expert when it comes to the snaps, but I will try to help as much as I can.

The problem is that I'm not able to convince snapcraft to pick hstr (and ignore hh) in bin/ directory (while building). The tool keeps to pick hh regardles there is no hh in snapcraft.yaml. Perhaps the problem might be that automake-based build creates hstr in bin/ directory + symlink hh to hstr. Does it make sense? Can I choose which binary to pick? Can I delete symlink as a part of snapcraft build?

You can exclude the hh binary from the snap in the parts/hstr/prime subsection:

parts:
  hstr:
    ...
    prime:
      - -bin/hh

Note: Notice the minus sign in front of the bin/hh

The snapcraft.yaml file would look like this.

You can also have the hstr and hh binary file in the snap. In this case the apps subsection would look like this:

apps:
  hstr:
    command: bin/hstr
  hh:
    command: bin/hh

Note: Now you have access to two executables hstr and an alias hstr.hh (and the prime subsection is missing)

The snapcraft.yaml file would look like this.

In both cases the hstr is the primary executable.

dvorka commented 5 years ago

@fszymanski These are great suggestions - thank you!