Skip to content

Commit a82c99b

Browse files
committed
Renames set --parent to set --parents
1 parent c376481 commit a82c99b

17 files changed

Lines changed: 62 additions & 60 deletions

File tree

asdf.elv

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -150,29 +150,29 @@ fn arg-completer {|@argz|
150150
# asdf list <name> [<version>]
151151
ls-installed-versions $argz[-1]
152152
} elif (match $argz 'local') {
153-
# asdf local <name> [-p|--parent]
153+
# asdf local <name> [-p|--parents]
154154
asdf plugin-list
155155
put '-p'
156-
put '--parent'
157-
} elif (match $argz 'local' '(-p|(--parent))') {
158-
# asdf local <name> [-p|--parent] <version>
156+
put '--parents'
157+
} elif (match $argz 'local' '(-p|(--parents))') {
158+
# asdf local <name> [-p|--parents] <version>
159159
asdf plugin-list
160160
} elif (match $argz 'local' '.*') {
161-
# asdf local <name> [-p|--parent]
161+
# asdf local <name> [-p|--parents]
162162
# asdf local <name> <version>
163163
ls-installed-versions $argz[-1]
164164
put '-p'
165-
put '--parent'
166-
} elif (match $argz 'local' '(-p|(--parent))' '.*') {
167-
# asdf local [-p|--parent] <name> <version>
165+
put '--parents'
166+
} elif (match $argz 'local' '(-p|(--parents))' '.*') {
167+
# asdf local [-p|--parents] <name> <version>
168168
ls-installed-versions $argz[-1]
169-
} elif (match $argz 'local' '.*' '(-p|(--parent))') {
170-
# asdf local <name> [-p|--parent] <version>
169+
} elif (match $argz 'local' '.*' '(-p|(--parents))') {
170+
# asdf local <name> [-p|--parents] <version>
171171
ls-installed-versions $argz[-2]
172172
} elif (match $argz 'local' '.*' '.*') {
173-
# asdf local <name> <version> [-p|--parent]
173+
# asdf local <name> <version> [-p|--parents]
174174
put '-p'
175-
put '--parent'
175+
put '--parents'
176176
} elif (or (match $argz 'plugin-add') (match $argz 'plugin' 'add')) {
177177
# asdf plugin add <name>
178178
asdf plugin-list-all | each {|line|

docs/guide/upgrading-to-v0-16.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ terminology was wrong and also misleading. asdf doesn't actually support
110110
current directory specifying a different version. This was confusing to users.
111111
The new `asdf set` behaves the same as `asdf local` by default, but also has
112112
flags for setting versions in the user's home directory (`--home`) and in an
113-
existing `.tool-versions` file in one of the parent directories (`--parent`).
113+
existing `.tool-versions` file in one of the parent directories (`--parents`).
114114
This new interface will hopefully convey a better understanding of how asdf
115115
resolves versions and provide equivalent functionality.
116116

docs/ja-jp/guide/upgrading-to-v0-16.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ asdfバージョン0.15.0およびそれ以前では、特定のコマンドの
7878

7979
### `asdf global``asdf local` コマンドが `asdf set` に変更されました
8080

81-
`asdf global` と `asdf local` は削除されました。「グローバル」と「ローカル」という用語は誤りで、誤解を招く恐れがありました。asdf は、実際にはあらゆる場所に適用される「グローバル」バージョンをサポートしていません。`asdf global`で指定したバージョンは、カレントディレクトリにある `.tool-versions` ファイルで簡単に上書きすることができました。これはユーザーを混乱させていました。 新しい`asdf set`はデフォルトでは`asdf local`と同じように動作しますが、ユーザーのホームディレクトリ (`--home`) や親ディレクトリ (`--parent`) にある既存の `.tool-versions` ファイルにバージョンを設定するためのフラグも用意されています。 この新しいインターフェイスは、asdfがどのようにバージョンを解決するかをよりよく理解し、同等の機能を提供することを期待しています。
81+
`asdf global` と `asdf local` は削除されました。「グローバル」と「ローカル」という用語は誤りで、誤解を招く恐れがありました。asdf は、実際にはあらゆる場所に適用される「グローバル」バージョンをサポートしていません。`asdf global`で指定したバージョンは、カレントディレクトリにある `.tool-versions` ファイルで簡単に上書きすることができました。これはユーザーを混乱させていました。 新しい`asdf set`はデフォルトでは`asdf local`と同じように動作しますが、ユーザーのホームディレクトリ (`--home`) や親ディレクトリ (`--parents`) にある既存の `.tool-versions` ファイルにバージョンを設定するためのフラグも用意されています。 この新しいインターフェイスは、asdfがどのようにバージョンを解決するかをよりよく理解し、同等の機能を提供することを期待しています。
8282

8383
### `asdf update`コマンドが削除されました
8484

docs/ja-jp/manage/versions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ asdf set <name> latest[:<version>]
8383

8484
`u` または `--home`フラグをつけて`asdf set`を実行すると、`$HOME`ディレクトリの`.tool-versions`ファイルにバージョンを書き込みます。ファイルが存在しない場合は作成されます。
8585

86-
`p`または `--parent`フラグをつけて`asdf set`を実行すると、カレントディレクトリから親ディレクトリを探索し、最初に見つかった`.tool-versions` ファイルにバージョンを書き込みます。
86+
`p`または `--parents`フラグをつけて`asdf set`を実行すると、カレントディレクトリから親ディレクトリを探索し、最初に見つかった`.tool-versions` ファイルにバージョンを書き込みます。
8787

8888
#### 環境変数で管理する
8989

docs/manage/versions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ just doing `echo "<tool> <version>" > .tool-versions`.
8686
With the `-u`/`--home` flag `asdf set` writes to the `.tool-versions` file in
8787
your `$HOME` directory, creating the file if it does not exist.
8888

89-
With the `-p`/`--parent` flag `asdf set` finds a `.tool-versions` file in the
89+
With the `-p`/`--parents` flag `asdf set` finds a `.tool-versions` file in the
9090
closest parent directory of the current directory.
9191

9292
#### Via Environment Variable

internal/cli/cli.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -275,16 +275,16 @@ func Execute(version string) {
275275
Usage: "The version should be set in the current users home directory",
276276
},
277277
&cli.BoolFlag{
278-
Name: "parent",
278+
Name: "parents",
279279
Aliases: []string{"p"},
280-
Usage: "The version should be set in the closest existing .tool-versions file in a parent directory",
280+
Usage: "The version should be set in the closest existing .tool-versions file in a parent directory.",
281281
},
282282
},
283283
Action: func(cCtx *cli.Context) error {
284284
args := cCtx.Args().Slice()
285285
home := cCtx.Bool("home")
286-
parent := cCtx.Bool("parent")
287-
return set.Main(os.Stdout, os.Stderr, args, home, parent, func() (string, error) {
286+
parents := cCtx.Bool("parents")
287+
return set.Main(os.Stdout, os.Stderr, args, home, parents, func() (string, error) {
288288
return os.UserHomeDir()
289289
})
290290
},

internal/cli/set/set.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
)
1616

1717
// Main function is the entrypoint for the 'asdf set' command
18-
func Main(_ io.Writer, stderr io.Writer, args []string, home bool, parent bool, homeFunc func() (string, error)) error {
18+
func Main(_ io.Writer, stderr io.Writer, args []string, home bool, parents bool, homeFunc func() (string, error)) error {
1919
if len(args) < 1 {
2020
return printError(stderr, "tool and version must be provided as arguments")
2121
}
@@ -24,8 +24,8 @@ func Main(_ io.Writer, stderr io.Writer, args []string, home bool, parent bool,
2424
return printError(stderr, "version must be provided as an argument")
2525
}
2626

27-
if home && parent {
28-
return printError(stderr, "home and parent flags cannot both be specified; must be one location or the other")
27+
if home && parents {
28+
return printError(stderr, "home and parents flags cannot both be specified; must be one location or the other")
2929
}
3030

3131
conf, err := config.LoadConfig()
@@ -70,11 +70,11 @@ func Main(_ io.Writer, stderr io.Writer, args []string, home bool, parent bool,
7070
return printError(stderr, fmt.Sprintf("unable to get current directory: %s", err))
7171
}
7272

73-
if parent {
74-
// locate file in parent dir and update it
75-
path, found := findVersionFileInParentDir(conf, currentDir)
73+
if parents {
74+
// locate file in parents dir and update it
75+
path, found := findVersionFileInParentDirs(conf, currentDir)
7676
if !found {
77-
return printError(stderr, fmt.Sprintf("No %s version file found in parent directory", conf.DefaultToolVersionsFilename))
77+
return printError(stderr, fmt.Sprintf("No %s version file found in parent directories", conf.DefaultToolVersionsFilename))
7878
}
7979

8080
err = toolversions.WriteToolVersionsToFile(path, []toolversions.ToolVersions{tv})
@@ -94,7 +94,7 @@ func printError(stderr io.Writer, msg string) error {
9494
return errors.New(msg)
9595
}
9696

97-
func findVersionFileInParentDir(conf config.Config, directory string) (string, bool) {
97+
func findVersionFileInParentDirs(conf config.Config, directory string) (string, bool) {
9898
directory = filepath.Dir(directory)
9999

100100
for {

internal/cli/set/set_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ func TestAll(t *testing.T) {
3232
assert.Equal(t, stderr.String(), "version must be provided as an argument")
3333
})
3434

35-
t.Run("prints error when both --parent and --home flags are set", func(t *testing.T) {
35+
t.Run("prints error when both --parents and --home flags are set", func(t *testing.T) {
3636
stdout, stderr := buildOutputs()
3737
err := Main(&stdout, &stderr, []string{"lua", "5.2.3"}, true, true, homeFunc)
3838

39-
assert.Error(t, err, "home and parent flags cannot both be specified; must be one location or the other")
39+
assert.Error(t, err, "home and parents flags cannot both be specified; must be one location or the other")
4040
assert.Equal(t, stdout.String(), "")
41-
assert.Equal(t, stderr.String(), "home and parent flags cannot both be specified; must be one location or the other")
41+
assert.Equal(t, stderr.String(), "home and parents flags cannot both be specified; must be one location or the other")
4242
})
4343

4444
t.Run("sets version in current directory when no flags provided", func(t *testing.T) {
@@ -58,7 +58,7 @@ func TestAll(t *testing.T) {
5858
assert.Equal(t, "lua 5.2.3\n", string(bytes))
5959
})
6060

61-
t.Run("sets version in parent directory when --parent flag provided", func(t *testing.T) {
61+
t.Run("sets version in parents directory when --parents flag provided", func(t *testing.T) {
6262
stdout, stderr := buildOutputs()
6363
dir := t.TempDir()
6464
subdir := filepath.Join(dir, "subdir")

internal/completions/asdf.elvish

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,29 +55,29 @@ fn arg-completer {|@argz|
5555
# asdf list <name> [<version>]
5656
ls-installed-versions $argz[-1]
5757
} elif (match $argz 'local') {
58-
# asdf local <name> [-p|--parent]
58+
# asdf local <name> [-p|--parents]
5959
asdf plugin-list
6060
put '-p'
61-
put '--parent'
62-
} elif (match $argz 'local' '(-p|(--parent))') {
63-
# asdf local <name> [-p|--parent] <version>
61+
put '--parents'
62+
} elif (match $argz 'local' '(-p|(--parents))') {
63+
# asdf local <name> [-p|--parents] <version>
6464
asdf plugin-list
6565
} elif (match $argz 'local' '.*') {
66-
# asdf local <name> [-p|--parent]
66+
# asdf local <name> [-p|--parents]
6767
# asdf local <name> <version>
6868
ls-installed-versions $argz[-1]
6969
put '-p'
70-
put '--parent'
71-
} elif (match $argz 'local' '(-p|(--parent))' '.*') {
72-
# asdf local [-p|--parent] <name> <version>
70+
put '--parents'
71+
} elif (match $argz 'local' '(-p|(--parents))' '.*') {
72+
# asdf local [-p|--parents] <name> <version>
7373
ls-installed-versions $argz[-1]
74-
} elif (match $argz 'local' '.*' '(-p|(--parent))') {
75-
# asdf local <name> [-p|--parent] <version>
74+
} elif (match $argz 'local' '.*' '(-p|(--parents))') {
75+
# asdf local <name> [-p|--parents] <version>
7676
ls-installed-versions $argz[-2]
7777
} elif (match $argz 'local' '.*' '.*') {
78-
# asdf local <name> <version> [-p|--parent]
78+
# asdf local <name> <version> [-p|--parents]
7979
put '-p'
80-
put '--parent'
80+
put '--parents'
8181
} elif (or (match $argz 'plugin-add') (match $argz 'plugin' 'add')) {
8282
# asdf plugin add <name>
8383
asdf plugin-list-all | each {|line|

internal/completions/asdf.fish

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ complete -f -c asdf -n '__fish_asdf_using_command set; and test (count (commandl
128128

129129
# set commands
130130
complete -f -c asdf -n '__fish_asdf_using_command set' -l home -d "Set version in home directory"
131-
complete -f -c asdf -n '__fish_asdf_using_command set' -l parent -d "Set version in parent directory"
131+
complete -f -c asdf -n '__fish_asdf_using_command set' -l parents -d "Set version in closest parent directory"
132132

133133
# misc
134134
complete -f -c asdf -n __fish_asdf_needs_command -l help -d "Displays help"

0 commit comments

Comments
 (0)