From a922c9159de647d0450a10d7cc3489c113cd4db6 Mon Sep 17 00:00:00 2001 From: "Hristos N. Triantafillou" Date: Sat, 29 Feb 2020 11:49:44 -0600 Subject: [PATCH] Properly sort by Label, alter test data for this --- obpmg.go | 6 ++++-- sample.yml | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/obpmg.go b/obpmg.go index 10f8a25..8f0c096 100644 --- a/obpmg.go +++ b/obpmg.go @@ -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", diff --git a/sample.yml b/sample.yml index 9629689..8379500 100644 --- a/sample.yml +++ b/sample.yml @@ -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 -- 2.45.2