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

Doesn't read umconfig in ~/.um -- Doesn't recognize $UMCONFIG_HOME variable #33

Closed
lmburns opened this issue May 3, 2021 · 6 comments
Closed

Comments

@lmburns
Copy link

lmburns commented May 3, 2021

System: Darwin void.local 20.3.0 Darwin Kernel Version 20.3.0: Thu Jan 21 00:07:06 PST 2021; root:xnu-7195.81.3~1/RELEASE_X86_64 x86_64 i386 MacBookPro14,1 Darwin
Installed through: brew

If I set a different pager in $HOME/.um/umconfig nothing changes.

Also, if I set the environment variable UMCONFIG_HOME in my .zshrc, it doesn't recognize the change and says there are no pages available. I also tried setting it on the command line with export UMCONFIG_HOME="${XDG_CONFIG_HOME}/um"and still nothing worked.

@beelsr
Copy link

beelsr commented May 26, 2021

what does it say for value of the variable?

echo "$UMCONFIG_HOME"

if you enter the command um config, where does it say your umconfig file is?

$ um config
Options prefixed by '*' are set in /home/rally1/.um/umconfig.
* editor = joe
  pager = less
  pages_directory = /home/rally1/.um/pages
  default_topic = shell
* pages_ext = .md2020

@lmburns
Copy link
Author

lmburns commented May 27, 2021

Here is the output of um config

 $ um config                                                                         【 ~/test】─╯
Options prefixed by '*' are set in /Users/lucasburns/.config/um/umconfig.
  editor = nvim
  pager = /usr/local/bin/less
  pages_directory = /Users/lucasburns/.um/pages
  default_topic = shell
  pages_ext = .md

Also, after I run

export UMCONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}/um"

and then run um config again, the same output is shown.

Output of echo

 $ echo $UMCONFIG_HOME                                                               【 ~/test】─╯
/Users/lucasburns/.config/um

Also, I noticed that the first time I ran um config the pager was equivalent to what my umconfig file was set to, which is:

pager = bat
editor = nvim

and the second time I ran it, it changed to /usr/local/bin/less

@beelsr
Copy link

beelsr commented May 27, 2021

Not a Mac person anymore but I have a couple ideas.

It looks like UMCONFIG_HOME is getting set to something. But you are using a different location than your OP. $HOME/.config/um or $HOME/um ?
You mention running export UMCONFIG... - this should be in your ~/.zshrc file so it gets run at every interactive terminal instance.
Is your file in the .../.config/um folder? When troubleshooting things like this, I find it quicker to hardcode variables to get it to work. Minimizing the, umm, variables. Also, note the change in location in your posts.

It looks like it worked at least once if you got bat for your pager. Did you see the asterisk override on the output? But when you say you ran it the second time, was this just a second invocation of um config with no intervening process? Or it gave correct output, you did the export and then it ran differently?

@lmburns
Copy link
Author

lmburns commented May 27, 2021

Yes, I know it needs to be set in my .zshrc. I said that I exported it on the command line as well just to show that that didn't work either. I am attempting to place the um folder in my .config directory.

My .zshrc contains the following:

export UMCONFIG_HOME="${XDG_CONFIG_HOME}/um"

If I export it on the command line, or I export $HOME/.config/um it does nothing. The reason why I had $XDG_CONFIG_HOME:-$HOME/.config was to set a fallback variable for whatever reason if um did not read the $XDG_CONFIG_HOME variable, which the output of that is:

 $ echo $XDG_CONFIG_HOME                                                                    【 ~opt】─╯
/Users/lucasburns/.config

The part on about where it first said bat and then said /usr/local/bin/less, I did nothing either except run um config twice.

I do not know any ruby whatsoever, however, a script that is setup similar to how um is prints out the correct location.
Script:

#!/usr/bin/env ruby

require 'fileutils'

DEFAULT_CONFIG_DIR_REL_PATH = '~/.um'.freeze

config_dir = ENV['UMCONFIG_HOME'] || DEFAULT_CONFIG_DIR_REL_PATH
config_path = File.expand_path(config_dir + '/umconfig')

print config_path

Output:

 $ ./test.rb                                                                           【 ~pro/ruby】─╯
/Users/lucasburns/.config/um/umconfig

@lmburns
Copy link
Author

lmburns commented May 27, 2021

I think I found the issue, um wasn't working in my mind because it said that no pages were loaded whenever I listed them. However, I see that I have to set the pages_directory now to the location of $UMCONFIG_HOME/pages. It must have been working the whole time and I didn't realize this.

I see in my first post the line Options prefixed by '*' are set in /Users/lucasburns/.config/um/umconfig, which means that it did get set. I feel kinda dumb now, sorry!

@lmburns lmburns closed this as completed May 27, 2021
@beelsr
Copy link

beelsr commented May 28, 2021

Ha! I'm glad it's figured out because I was feeling bad that I didn't have the magic answer.

I know Ruby just enough to spell it, so I think we're on par there.

Cheers!

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