commitpal icon indicating copy to clipboard operation
commitpal copied to clipboard

Loading a config file only works with relative paths 🤷‍♂️

Open joshuatvernon opened this issue 3 years ago • 2 comments

Loading a config file only works with relative paths 🤷‍♂️

Examples

  1. ~ expansion e.g.

    $ commitpal -c ~/.commitpal.config.json -n
    Error: /Users/jvernon/.commitpal.config.json not found
    
    ? Please choose a preset …
    Angular commit format
    Emoji
    Jira ticket
    
  2. Absolute paths e.g.

    $ commitpal -c /Users/jvernon/.commitpal.config.json -n
    Error: /Users/jvernon/.commitpal.config.json not found
    
    ? Please choose a preset …
    Angular commit format
    Emoji
    Jira ticket
    
  3. Relative paths e.g.

    commitpal -c ./.commitpal.config.json -n
    ? What type of change? …
    feature
    bugfix
    documentation
    style
    tests
    chore
    

joshuatvernon avatar Mar 15 '21 08:03 joshuatvernon

This is my current workaround 😋

function gcp() {
  if ! command -v commitpal &> /dev/null
  then
      npm install commitpal -g
  fi
  local config_path
  config_path=$(realpath --relative-to=. ~/.commitpal.config.json)
  commitpal -c "$config_path" -n
}

Then I can just run this from anywhere

$ gcp

joshuatvernon avatar Mar 15 '21 09:03 joshuatvernon

Hey @joshuatvernon, thanks for raising this issue!

I'm pretty sure if the config file is not specified, commitpal will attempt to climb the file tree to find one! You could try omitting the config flag to see if it picks up the file in the meantime.

I'll have to look into fixing the issues with the flag, that's definitely a big problem (would love a PR if you're up to it 😄)

danieldelcore avatar Mar 16 '21 06:03 danieldelcore