~crg


#15 Configuration file location 1 year, 3 months ago

Comment by ~crg on ~emersion/hut

Where does it say that? This is what I can see:

OPTIONS
       --config
           Explicitly select a configuration file that should be used over the default configuration.
...
CONFIGURATION
       Generate a new OAuth2 access token on meta.sr.ht.

       On startup hut will look for a file at $XDG_CONFIG_HOME/hut/config. If unset, $XDG_CONFIG_HOME defaults to ~/.config/.

           instance "sr.ht" {
                access-token "<token>"
                # As an alternative you can specify a command whose first line of output
                # will be parsed as the token
                access-token-cmd pass token
           }

#15 Configuration file location 1 year, 3 months ago

Ticket created by ~crg on ~emersion/hut

TL;DR - XDG_CONFIG_HOME is not respected on some platforms.

The configuration code relies on os.UserConfigDir() which says (formatting by me):

On Unix systems, it returns $XDG_CONFIG_HOME if non-empty, else $HOME/.config.

On Darwin, it returns $HOME/Library/Application Support.

On Windows, it returns %AppData%.

On Plan 9, it returns $home/lib.

Ideally the configuration code would respect XDG_CONFIG_HOME even on MacOS for example. I think that's typical for CLI tools. Otherwise, the README should tell users where to put the file based on their platform.

#14 Cross-platform Makefile 1 year, 3 months ago

Ticket created by ~crg on ~emersion/hut

TL;DR - Makefile depends on coreutils install, fails on BSD install.

Installation fails on MacOS where /usr/bin/install is the BSD install command. I resolved the issue by installing coreutils (brew install coreutils) and editing the Makefile (INSTALL = ginstall). Homebrew installs the coreutils with the prefix "g".

For the record, the errors that I saw originally:

~/Projects/hut> sudo make install
install -dp \
		/usr/local/bin/ \
		/usr/local/share/man/man1/ \
		/usr/local/share/bash-completion/completions \
		/usr/local/share/zsh/site-functions \
		/usr/local/share/fish/vendor_completions.d
install: the -d and -C options may not be specified together
install -pm 0755 hut -t /usr/local/bin/
install: -t: No such file or directory
make: *** [install] Error 71

It would be nice if the Makefile was cross-platform.