Change {Key: key, Value: xxx} to {key: xxx}#17
Conversation
|
Thanks for the PR! I really like the direction of moving toward XDG support, but I have some concerns about the current implementation. One of the goals of the current architecture is to allow complete isolation of any Git configuration, not just user identity settings. For example, it’s currently possible to do something like: With the approach proposed in this PR, the tool becomes limited to just three settings: user.name, user.email, and user.signingkey. I’d like to preserve the existing flexibility, since it allows users to isolate and manage arbitrary Git configuration values, not only identity-related ones. |
- test: add testing for old and new config formats - feat: sort by configuration keys when using `list` command
Thanks, I was totally wondering on how to remove homedir entirely, since its deprecated and all. ATM, only root.go uses it. We can find another library, or just homebrew it such as below. Not sure if I should add it in this PR, however. func ParseFilePath(fp string) (string, error) {
if fp == "" {
return "", fmt.Errorf("empty path")
}
// ~ to home
if fp == "~" {
return xdg.Home, nil
}
// ~/path to home/path
if strings.HasPrefix(fp, "~/") {
return filepath.Join(xdg.Home, fp[2:]), nil
}
// ~username unsupported, SSH config shouldn't need this probably
if strings.HasPrefix(fp, "~") && fp[1] != '/' {
return "", fmt.Errorf("unsupported: ~username expansion")
}
// clean it up
return filepath.Clean(fp), nil
}
This is absolutely my bad, I was very conflicted on whether I should use what's on the files themselves, or be flexible, along with my somewhat inexperience with go, of which I played safe. On that note, the new commits does allow for flexibility specified in your comment. |
changed the config file to key:value instead of Key: value, Value: value
How about current installs?
Upon update, it would migrate from old configuration to new configuration in place.
Note: after this update, the config won't be backwards compatible.
Possible Fix
Put the new config into the config directly with XDG