Skip to content

Commit 6ff85ef

Browse files
committedNov 21, 2020
if user.name is not set print unknown instead of crashing
1 parent 09eda66 commit 6ff85ef

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed
 

Diff for: ‎README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ It automatically detects open source licenses from texts and provides the user w
2323

2424
<img src="assets/kubernetes.png" align="right" height="240px">
2525

26-
Onefetch can be configured via command-line flags to display exactly what you want, the you want it to: you can customize ASCII/Text formatting, disable info lines, ignore files & directories, etc. Read more about it [here](https://github.com/o2sh/onefetch/wiki/command-line-options).
26+
Onefetch can be configured via command-line flags to display exactly what you want, the you want it to: you can customize ASCII/Text formatting, disable info lines, ignore files & directories, etc; read more about it [here](https://github.com/o2sh/onefetch/wiki/command-line-options).
2727

2828
As of now, onefetch supports more than 50 different programming languages; if your language of choice isn't supported: Open up an issue and support will be added.
2929

Diff for: ‎src/onefetch/repo.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,12 @@ impl Repo {
3535

3636
pub fn get_git_username(&self) -> Result<String> {
3737
let config = self.repo.config()?;
38-
let username = config.get_entry("user.name")?;
39-
Ok(username.value().unwrap_or("unknown").to_string())
38+
let username = match config.get_entry("user.name") {
39+
Ok(v) => v.value().unwrap_or("unknown").into(),
40+
Err(_) => "unknown".into(),
41+
};
42+
43+
Ok(username)
4044
}
4145

4246
pub fn get_version(&self) -> Result<String> {

0 commit comments

Comments
 (0)
Please sign in to comment.