From cbd1338f3e58680276945a65bee94648b3f636ef Mon Sep 17 00:00:00 2001 From: Tran Hau Date: Wed, 14 Apr 2021 04:53:21 +0000 Subject: [PATCH] refactor: move aliases to pre-define var --- main.go | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/main.go b/main.go index f2e0f99..7bb3c8c 100644 --- a/main.go +++ b/main.go @@ -19,11 +19,17 @@ const ( currentDir = "." ) -// denyOSes contains OS which is not supported -// go tool dist list -var denyOSes = map[string]struct{}{ - "windows": struct{}{}, -} +var ( + installAliases = []string{"i"} + updateAliases = []string{"u"} + cleanAliases = []string{"c"} + + // denyOSes contains OS which is not supported + // go tool dist list + denyOSes = map[string]struct{}{ + "windows": struct{}{}, + } +) func main() { // Prevent running at runtime @@ -40,19 +46,19 @@ func main() { Commands: []*cli.Command{ { Name: installCommand, - Aliases: []string{"i"}, + Aliases: installAliases, Usage: "install user configs from dotfiles", Action: a.RunInstall, }, { Name: updateCommand, - Aliases: []string{"u"}, + Aliases: installAliases, Usage: "update dotfiles from user configs", Action: a.RunUpdate, }, { Name: cleanCommand, - Aliases: []string{"c"}, + Aliases: installAliases, Usage: "clean unused dotfiles", Action: a.RunClean, },