3 comments
Comment actions Permalink

Can you provide more information about what you're trying to do? Are you trying to get the GitHub name from the user in your plugin? Are you you trying to get user information from the GitHub API?

0
Comment actions Permalink

Yes, I want to read the user's GitHub information in the plug-in. I use this method now, but I want to know whether there is a simpler API to use

public static String readGithubName() {
String cmd="git config user.name";
String line;
StringBuilder sb = new StringBuilder();
Runtime runtime = Runtime.getRuntime();
try {
Process process = runtime.exec(cmd);
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream()));
while ((line = bufferedReader.readLine()) != null) {
sb.append(line);
}
return sb.toString();
} catch (Exception e) {
return "null";
}
}
0
Comment actions Permalink

Just now, I found it

org.jetbrains.plugins.github.authentication.accounts.GHAccountManager
0

Please sign in to leave a comment.