Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: use short names for repository commands #670

Merged
merged 4 commits into from
Nov 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions cmd/oras/copy.go → cmd/oras/cp.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,27 +45,27 @@ type copyOptions struct {
func copyCmd() *cobra.Command {
var opts copyOptions
cmd := &cobra.Command{
Use: "copy [flags] <from>{:<tag>|@<digest>} <to>[:<tag>[,<tag>][...]]",
Aliases: []string{"cp"},
Use: "cp [flags] <from>{:<tag>|@<digest>} <to>[:<tag>[,<tag>][...]]",
Aliases: []string{"copy"},
Short: "[Preview] Copy artifacts from one target to another",
Long: `[Preview] Copy artifacts from one target to another

** This command is in preview and under development. **

Example - Copy the artifact tagged with 'v1' from repository 'localhost:5000/net-monitor' to repository 'localhost:5000/net-monitor-copy'
oras copy localhost:5000/net-monitor:v1 localhost:5000/net-monitor-copy:v1
oras cp localhost:5000/net-monitor:v1 localhost:5000/net-monitor-copy:v1

Example - Copy the artifact tagged with 'v1' and its referrers from repository 'localhost:5000/net-monitor' to 'localhost:5000/net-monitor-copy'
oras copy -r localhost:5000/net-monitor:v1 localhost:5000/net-monitor-copy:v1
oras cp -r localhost:5000/net-monitor:v1 localhost:5000/net-monitor-copy:v1

Example - Copy the artifact tagged with 'v1' from repository 'localhost:5000/net-monitor' to 'localhost:5000/net-monitor-copy' with certain platform
oras copy --platform linux/arm/v5 localhost:5000/net-monitor:v1 localhost:5000/net-monitor-copy:v1
oras cp --platform linux/arm/v5 localhost:5000/net-monitor:v1 localhost:5000/net-monitor-copy:v1

Example - Copy the artifact tagged with 'v1' from repository 'localhost:5000/net-monitor' to 'localhost:5000/net-monitor-copy' with multiple tags
oras copy localhost:5000/net-monitor:v1 localhost:5000/net-monitor-copy:v1,tag2,tag3
oras cp localhost:5000/net-monitor:v1 localhost:5000/net-monitor-copy:v1,tag2,tag3

Example - Copy the artifact tagged with 'v1' from repository 'localhost:5000/net-monitor' to 'localhost:5000/net-monitor-copy' with multiple tags and concurrency level tuned
oras copy --concurrency 6 localhost:5000/net-monitor:v1 localhost:5000/net-monitor-copy:v1,tag2,tag3
oras cp --concurrency 6 localhost:5000/net-monitor:v1 localhost:5000/net-monitor-copy:v1,tag2,tag3
`,
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down
4 changes: 2 additions & 2 deletions cmd/oras/repository/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ import (

func Cmd() *cobra.Command {
cmd := &cobra.Command{
Use: "repository [command]",
Use: "repo [command]",
Short: "[Preview] Repository operations",
Aliases: []string{"repo"},
Aliases: []string{"repository"},
}

cmd.AddCommand(
Expand Down
8 changes: 4 additions & 4 deletions cmd/oras/repository/list.go → cmd/oras/repository/ls.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,20 @@ type repositoryOptions struct {
func listCmd() *cobra.Command {
var opts repositoryOptions
cmd := &cobra.Command{
Use: "list [flags] <registry>",
Use: "ls [flags] <registry>",
Short: "[Preview] List the repositories under the registry",
Long: `[Preview] List the repositories under the registry

** This command is in preview and under development. **

Example - List the repositories under the registry:
oras repository list localhost:5000
oras repo ls localhost:5000

Example - List the repositories under the registry that include values lexically after last:
oras repository list --last "last_repo" localhost:5000
oras repo ls --last "last_repo" localhost:5000
`,
Args: cobra.ExactArgs(1),
Aliases: []string{"ls"},
Aliases: []string{"list"},
RunE: func(cmd *cobra.Command, args []string) error {
opts.hostname = args[0]
return listRepository(opts)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,23 @@ type showTagsOptions struct {
func showTagsCmd() *cobra.Command {
var opts showTagsOptions
cmd := &cobra.Command{
Use: "show-tags [flags] <name>",
Use: "tags [flags] <name>",
Short: "[Preview] Show tags of the target repository",
Long: `[Preview] Show tags of the target repository

** This command is in preview and under development. **

Example - Show tags of the target repository:
oras repository show-tags localhost:5000/hello
oras repo tags localhost:5000/hello

Example - Show tags in the target repository with digest-like tags hidden:
oras repository show-tags --exclude-digest-tag localhost:5000/hello
oras repo tags --exclude-digest-tag localhost:5000/hello

Example - Show tags of the target repository that include values lexically after last:
oras repository show-tags --last "last_tag" localhost:5000/hello
oras repo tags --last "last_tag" localhost:5000/hello
`,
Args: cobra.ExactArgs(1),
Aliases: []string{"tags"},
Aliases: []string{"show-tags"},
RunE: func(cmd *cobra.Command, args []string) error {
opts.targetRef = args[0]
return showTags(opts)
Expand Down