mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-30 09:33:39 +01:00
Watch: adds -w/--watch as a seconds-based alias for --dynamic-interval
Closes #2478
This commit is contained in:
@@ -83,6 +83,16 @@
|
||||
"type": "num",
|
||||
"default": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"long": "watch",
|
||||
"short": "w",
|
||||
"desc": "Alias of dynamic-interval, but the value is in seconds instead of milliseconds. If no value is provided, it defaults to 1 second",
|
||||
"arg": {
|
||||
"type": "num",
|
||||
"optional": true,
|
||||
"default": 1
|
||||
}
|
||||
}
|
||||
],
|
||||
"Config": [
|
||||
|
||||
@@ -670,6 +670,12 @@ static void parseCommand(FFdata* data, char* key, char* value) {
|
||||
}
|
||||
} else if (ffStrEqualsIgnCase(key, "--dynamic-interval")) {
|
||||
instance.state.dynamicInterval = ffOptionParseUInt32(key, value); // seconds to milliseconds
|
||||
} else if (ffStrEqualsIgnCase(key, "-w") || ffStrEqualsIgnCase(key, "--watch")) {
|
||||
if (value == nullptr) {
|
||||
instance.state.dynamicInterval = 1000; // default to 1 second if no value is provided
|
||||
} else {
|
||||
instance.state.dynamicInterval = ffOptionParseUInt32(key, value) * 1000; // seconds to milliseconds
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user