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

Support relative paths for snippet's filename attribute - only absolute works now #320

Closed
RamiAwar opened this issue Oct 10, 2024 Discussed in #317 · 3 comments · Fixed by #322
Closed

Support relative paths for snippet's filename attribute - only absolute works now #320

RamiAwar opened this issue Oct 10, 2024 Discussed in #317 · 3 comments · Fixed by #322

Comments

@RamiAwar
Copy link
Collaborator

RamiAwar commented Oct 10, 2024

Discussed in #317

Originally posted by csessh October 4, 2024
Let's say I have this config:

[General]
Backend = "gist"
Cmd = []
Color = true
Column = 50
Editor = "nvim"
Format = "[$tags] [$description] > $command"
SelectCmd = "fzf --ansi --highlight-line --layout=reverse --border --height=90% --pointer=* --cycle --prompt=Snippets:"
SnippetDirs = []
SnippetFile = "~/.config/pet/snippet.toml"
SortBy = "recency"

I specify a snippet.toml file path like so:

SnippetFile = "~/.config/pet/snippet.toml"

pet new would create an entry like this:

[[Snippets]]
  Description = "Prune git repo"
  Filename = "/home/csessh/.config/pet/snippet.toml"
  Output = ""
  Tag = ["git"]
  command = "git fetch --all --prune"

Filename attribute is displayed as absolute path. This doesn't play too well with porting configs/snippets from one workstation to another if they don't share the same username.

We should support relative paths as well.

.
@csessh
Copy link
Contributor

csessh commented Oct 11, 2024

@RamiAwar
I take that you'd prefer pet provides an option for the user to choose between absolute and relative path?

a boolean switch in pet configure config file? like so?

ExpandPaths = true/false

@RamiAwar
Copy link
Collaborator Author

Idk, is that really necessary?

Can you think of an edge case where there is confusion? ex. user inputs relative but expects absolute, or vice versa

My initial feeling is that it will be clear from the path itself if it is relative or absolute. So we don't need this extra config.

@csessh
Copy link
Contributor

csessh commented Oct 11, 2024

ah yeah. you're right.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants