-
-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2042 from rsteube/fastfetch-move-actions
fastfetch: moved actions
- Loading branch information
Showing
5 changed files
with
92 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package fastfetch | ||
|
||
import ( | ||
"github.com/rsteube/carapace" | ||
"github.com/rsteube/carapace/pkg/style" | ||
) | ||
|
||
// ActionColors completes colors | ||
// | ||
// black | ||
// red | ||
func ActionColors() carapace.Action { | ||
return carapace.ActionStyledValues( | ||
"black", style.Black, | ||
"red", style.Red, | ||
"green", style.Green, | ||
"yellow", style.Yellow, | ||
"blue", style.Blue, | ||
"magenta", style.Magenta, | ||
"cyan", style.Cyan, | ||
"white", style.White, | ||
"default", style.Default, | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package fastfetch | ||
|
||
import ( | ||
"strings" | ||
|
||
"github.com/rsteube/carapace" | ||
"github.com/rsteube/carapace/pkg/style" | ||
) | ||
|
||
// ActionLogos completes logos | ||
// | ||
// Alter | ||
// Amazon | ||
func ActionLogos() carapace.Action { | ||
return carapace.ActionExecCommand("fastfetch", "--list-logos", "autocompletion")(func(output []byte) carapace.Action { | ||
logos := strings.Split(strings.TrimRight(string(output), "\n"), "\n") | ||
return carapace.Batch( | ||
carapace.ActionValuesDescribed( | ||
"none", "Disable logo", | ||
"small", "Show small logo if supported", | ||
), | ||
carapace.ActionValues(logos...).Style(style.Blue).Tag("builtin logos"), | ||
).ToA() | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package fastfetch | ||
|
||
import ( | ||
"strings" | ||
|
||
"github.com/rsteube/carapace" | ||
) | ||
|
||
// ActionModules completes modules | ||
// | ||
// Board (Print mather board name and other info) | ||
// Break (Print a empty line) | ||
func ActionModules() carapace.Action { | ||
return carapace.ActionExecCommand("fastfetch", "--list-modules", "autocompletion")(func(output []byte) carapace.Action { | ||
var texts []string | ||
for _, line := range strings.Split(strings.TrimRight(string(output), "\n"), "\n") { | ||
name, desc, _ := strings.Cut(line, ":") | ||
texts = append(texts, name, desc) | ||
} | ||
return carapace.ActionValuesDescribed(texts...) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package fastfetch | ||
|
||
import ( | ||
"strings" | ||
|
||
"github.com/rsteube/carapace" | ||
) | ||
|
||
// ActionPresets completes presets | ||
func ActionPresets() carapace.Action { | ||
return carapace.ActionExecCommand("fastfetch", "--list-presets", "autocompletion")(func(output []byte) carapace.Action { | ||
presets := strings.Split(strings.TrimRight(string(output), "\n"), "\n") | ||
return carapace.ActionValues(presets...) | ||
}) | ||
} |