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

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

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

问题

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

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

  1. $ aws s3 cp --help
  2. 用法: aws [-h] [--profile PROFILE] [--debug]
  3. 选项:
  4. -h, --help 显示此帮助消息并退出
  5. --profile PROFILE
  6. --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:

  1. $ aws s3 cp --help
  2. usage: aws [-h] [--profile PROFILE] [--debug]
  3. options:
  4. -h, --help show this help message and exit
  5. --profile PROFILE
  6. --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。当您键入以下命令时:

  1. aws s3 cp help

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

  1. CP() CP()
  2. NAME
  3. cp -
  4. DESCRIPTION
  5. Copies a local file or S3 object to another location locally or in S3.
  6. SYNOPSIS
  7. cp
  8. <LocalPath> <S3Uri> or <S3Uri> <LocalPath> or <S3Uri> <S3Uri>
  9. [--dryrun]
  10. [--quiet]
  11. [--include <value>]
  12. [--exclude <value>]
  13. ...

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

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

英文:

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

  1. aws s3 cp help

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

  1. CP() CP()
  2. NAME
  3. cp -
  4. DESCRIPTION
  5. Copies a local file or S3 object to another location locally or in S3.
  6. SYNOPSIS
  7. cp
  8. <LocalPath> <S3Uri> or <S3Uri> <LocalPath> or <S3Uri> <S3Uri>
  9. [--dryrun]
  10. [--quiet]
  11. [--include <value>]
  12. [--exclude <value>]
  13. ...

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:

确定