如何获取有意义的 AWS CLI 子命令(如 `aws s3 cp`)的帮助页面?

huangapple go评论58阅读模式
英文:

How to get meaningful help pages for aws CLI subcommands like `aws s3 cp`?

问题

我正在尝试查找aws s3 cp CLI命令的选项,但以下两种方式都不起作用。

当我使用--help-h时,我得到以下无用的CLI输出,没有提到s3,更不用说s3 cp子命令了:

$ aws s3 cp --help
     
用法: aws [-h] [--profile PROFILE] [--debug]

选项:
  -h, --help         显示此帮助消息并退出
  --profile PROFILE
  --debug

我也找不到使用man awsman aws-s3man aws-s3-cp来查找手册页面。

我知道我可以在网上找到文档:https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3/cp.html,但我如何在终端中直接获取类似的信息呢?

英文:

I'm trying to figure out what options there are for the aws s3 cp CLI command but neither of the following work.

When I use --help or -h I get the following useless CLI output that doesn't say anything about s3, let alone s3 cp subcommands:

$ aws s3 cp --help
     
usage: aws [-h] [--profile PROFILE] [--debug]

options:
  -h, --help         show this help message and exit
  --profile PROFILE
  --debug

Neither can I find man pages using man aws, man aws-s3 or man aws-s3-cp.

I know I can find the docs online: https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3/cp.html but how do I get similar information directly in my terminal?

答案1

得分: 3

非直观的答案是在不使用--的情况下键入help。当您键入以下命令时:

aws s3 cp help

您将获得适当的手册页以在分页器中打开:

CP()                                                                      CP()

NAME
       cp -

DESCRIPTION
       Copies a local file or S3 object to another location locally or in S3.

SYNOPSIS
            cp
          <LocalPath> <S3Uri> or <S3Uri> <LocalPath> or <S3Uri> <S3Uri>
          [--dryrun]
          [--quiet]
          [--include <value>]
          [--exclude <value>]
...

我不太理解为什么AWS决定不接受几乎普遍标准的子命令-h。也许有人可以在评论中给我一些启发。

添加help 在任何地方都有效,甚至在原始的aws上也可以,比如aws help,这将再次打开一个手册页。奇怪的是,当使用-h 传递时,不会列出这个help 选项。

英文:

The unintuitive answer is to type help without the --. When you type:

aws s3 cp help

you get the appropriate man page to open in a pager:

CP()                                                                      CP()



NAME
       cp -

DESCRIPTION
       Copies a local file or S3 object to another location locally or in S3.

SYNOPSIS
            cp
          <LocalPath> <S3Uri> or <S3Uri> <LocalPath> or <S3Uri> <S3Uri>
          [--dryrun]
          [--quiet]
          [--include <value>]
          [--exclude <value>]
...

I don't quite understand why aws decided to not accept the nearly universal standard -h for subcommands. Maybe someone can enlighten me in the comments.

Adding help works everywhere, even on a raw aws as aws help which again opens a manpage. Strange that this help addition is not listed when passing -h.

答案2

得分: 1

尝试:aws s3 cp help

即从 --help 中删除破折号。

英文:

Try: aws s3 cp help

i.e. removing the dashes from --help

huangapple
  • 本文由 发表于 2023年2月9日 00:09:47
  • 转载请务必保留本文链接:https://go.coder-hub.com/75388596.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定