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

Allow further configuration by using git config names #81

Open
UnFefeSauvage opened this issue Oct 24, 2022 · 0 comments
Open

Allow further configuration by using git config names #81

UnFefeSauvage opened this issue Oct 24, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@UnFefeSauvage
Copy link

UnFefeSauvage commented Oct 24, 2022

Summary of the new feature/enhancement

In the extension settings, you could use git config names instead of "userName" and "email".

This could ease adding new settings to the profiles and would remove the need to translate fields to git config names
("userName" -> "user.name")

Then, to identify profiles, you could generate an id or use the profile label and put it as a custom field in the user config.

Proposed technical implementation details (optional)

The updated config format could look something like that:

{
  "label": "My profile",
  "config": {
    "user.name": "Alice Bob",
    "user.email": "alice.bob@example.de"
  },
  "selected": true
}

And could, for example, be updated by a user this way to configure GPG signing as well:

{
  "label": "My profile",
  "config": {
    "user.name": "Alice Bob",
    "user.email": "alice.bob@example.de"
    "user.signingkey": "ABCDEF0123456789BD",
    "commit.gpgsign": true
  },
  "selected": true
}

The id could be stored this way in .git/config:

[user]
  name = Alice Bob
  email = alice.bob@example.de
[gcup]
  profileId = My profile

We might want to validate config names, a regex like this one (untested) ^([a-zA-Z0-9]+\.?)+[a-zA-Z0-9]$ should do the trick.

Also, when switching profiles, we would have to remove each field of the previous profile before applying the new one.

I might look into it myself and make a pull request but I'm not familiar with TypeScript.

@UnFefeSauvage UnFefeSauvage added the enhancement New feature or request label Oct 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant