~hristoast/obpmg

a922c9159de647d0450a10d7cc3489c113cd4db6 — Hristos N. Triantafillou 4 years ago bc859ba v0.4
Properly sort by Label, alter test data for this
2 files changed, 6 insertions(+), 4 deletions(-)

M obpmg.go
M sample.yml
M obpmg.go => obpmg.go +4 -2
@@ 28,6 28,8 @@ import (
	"gopkg.in/yaml.v2"
)

const obpmg_version = "v0.4"

type xmlAction struct {
	XMLName xml.Name `xml:"action"`
	Name    string   `xml:"name,attr"`


@@ 65,7 67,7 @@ func getYamlData(filePath string, nosort bool) ([]yamlData, interface{}) {

	if nosort == false {
		// No special condition is needed, so just return true and sort everything.
		sort.SliceStable(y, func(i, j int) bool { return true })
		sort.SliceStable(y, func(i, j int) bool { return y[i].Label < y[j].Label })
	}

	return y, err


@@ 101,7 103,7 @@ func cliApp() *cli.App {

	app := &cli.App{
		Name:      "obpmg",
		Version:   "v0.3",
		Version:   obpmg_version,
		Compiled:  time.Now(),
		Usage:     "Generate an Openbox pipe menu from a yaml file.",
		UsageText: "obpmg [--nosort] -f /path/to/myfile.yml",

M sample.yml => sample.yml +2 -2
@@ 1,7 1,7 @@
---
- label: OpenMW
  exe: /opt/morrowind/openmw/bin/openmw-launcher
- label: MultiMC
  exe: /usr/bin/MultiMC
- label: 'FTL: Faster Than Light'
  exe: /home/hristos/games/FTL/FTL
- label: MultiMC
  exe: /usr/bin/MultiMC