This repository has been archived by the owner on Mar 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27
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 #28 from ublue-os/listprograms
feat: list programs
- Loading branch information
Showing
3 changed files
with
74 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
Copyright © 2023 NAME HERE <EMAIL ADDRESS> | ||
*/ | ||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
"strings" | ||
|
||
"github.com/spf13/cobra" | ||
"github.com/ublue-os/fleek/core" | ||
"github.com/vanilla-os/orchid/cmdr" | ||
) | ||
|
||
func NewListProgramsCommand() *cmdr.Command { | ||
cmd := cmdr.NewCommandRun( | ||
fleek.Trans("listPrograms.use"), | ||
fleek.Trans("listPrograms.long"), | ||
fleek.Trans("listPrograms.short"), | ||
listPrograms, | ||
) | ||
return cmd | ||
} | ||
|
||
// initCmd represents the init command | ||
func listPrograms(cmd *cobra.Command, args []string) { | ||
|
||
conf, err := core.ReadConfig() | ||
cobra.CheckErr(err) | ||
|
||
cmdr.Info.Println(fleek.Trans("listPrograms.userBling"), strings.ToUpper(conf.Bling)) | ||
switch conf.Bling { | ||
case "high": | ||
cmdr.Info.Println(fleek.Trans("listPrograms.highBling")) | ||
case "default": | ||
cmdr.Info.Println(fleek.Trans("listPrograms.defaultBling")) | ||
case "low": | ||
cmdr.Info.Println(fleek.Trans("listPrograms.lowBling")) | ||
|
||
} | ||
if conf.Bling == "high" { | ||
for _, pkg := range core.HighPrograms { | ||
fmt.Printf("\t%s\n", pkg) | ||
} | ||
} | ||
if conf.Bling == "default" || conf.Bling == "high" { | ||
|
||
for _, pkg := range core.DefaultPrograms { | ||
fmt.Printf("\t%s\n", pkg) | ||
} | ||
} | ||
for _, pkg := range core.LowPrograms { | ||
fmt.Printf("\t%s\n", pkg) | ||
} | ||
|
||
cmdr.Info.Println(fleek.Trans("listPrograms.userInstalled")) | ||
|
||
for _, pkg := range conf.Programs { | ||
fmt.Printf("\t%s\n", pkg) | ||
} | ||
|
||
} |
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