From 6c165fdc96d8a90c517fae717420d133eb5f073d Mon Sep 17 00:00:00 2001 From: zakuro Date: Tue, 23 Feb 2021 20:24:57 +0900 Subject: [PATCH] Remove task alias --- cli/cli.go | 3 --- config/task.go | 5 +---- config/task_test.go | 2 -- 3 files changed, 1 insertion(+), 9 deletions(-) diff --git a/cli/cli.go b/cli/cli.go index b3d50d3..2bdc5a1 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -174,9 +174,6 @@ func findTask(i *int, nzargs []nzflag.Value, config *config.Config) (task *confi if newTask, err := config.FindTask(fullName); err == nil { *i = i2 + 1 task = newTask - if len(task.AliasTo) > 0 { - task, _ = config.FindTask(task.AliasTo) - } } } } diff --git a/config/task.go b/config/task.go index 23e2f15..6f25ef9 100644 --- a/config/task.go +++ b/config/task.go @@ -38,7 +38,6 @@ type task struct { Cmds yaml.StringList `yaml:"run"` Envs Envs `yaml:"env"` Paths yaml.StringList `yaml:"path"` - AliasTo string `yaml:"z"` Config *Config Parent *Task Description string `yaml:"desc"` @@ -119,10 +118,8 @@ func (t *Task) expandVars() { } func (t *Task) Verify() error { - if len(t.Cmds) == 0 && len(t.AliasTo) == 0 { + if len(t.Cmds) == 0 { return errors.New("Nothing to run") - } else if len(t.Cmds) > 0 && len(t.AliasTo) > 0 { - return errors.New("Cannot use both of `z` and `run`") } return nil } diff --git a/config/task_test.go b/config/task_test.go index b7dd093..34640dd 100644 --- a/config/task_test.go +++ b/config/task_test.go @@ -8,7 +8,5 @@ import ( func TestVerify(t *testing.T) { assert.NoError(t, (&Task{task{Cmds: []string{"v"}}}).Verify()) - assert.NoError(t, (&Task{task{AliasTo: "v"}}).Verify()) assert.Error(t, (&Task{}).Verify()) - assert.Error(t, (&Task{task{Cmds: []string{"v"}, AliasTo: "v"}}).Verify()) }