Skip to content
This repository has been archived by the owner on Mar 24, 2024. It is now read-only.

Commit

Permalink
Merge pull request #28 from ublue-os/listprograms
Browse files Browse the repository at this point in the history
feat: list programs
  • Loading branch information
bketelsen authored Mar 21, 2023
2 parents f495e19 + d11e96d commit 0d293eb
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 1 deletion.
62 changes: 62 additions & 0 deletions cmd/list_programs.go
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)
}

}
10 changes: 9 additions & 1 deletion locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,15 @@ listPackages:
defaultBling: "Default Bling Packages:"
highBling: "High Bling Packages:"
userInstalled: "User Selected Packages:"

listPrograms:
use: "programs"
long: "List installed programs"
short: "List installed programs"
userBling: "Your Bling Level:"
lowBling: "Low Bling Programs:"
defaultBling: "Default Bling Programs:"
highBling: "High Bling Programs:"
userInstalled: "User Selected Programs:"
remove:
use: "remove [package] [package] ..."
long: "Remove a package or program from your configuration.\n Use the `--program` flag to specify a program which can also be configured by nix."
Expand Down
3 changes: 3 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ func main() {

list := cmd.NewListCommand()
listPkgs := cmd.NewListPackagesCommand()
listProgs := cmd.NewListProgramsCommand()

list.AddCommand(listPkgs)
list.AddCommand(listProgs)
root.AddCommand(list)
// run the app
err := fleek.Run()
Expand Down

0 comments on commit 0d293eb

Please sign in to comment.