All documented awscli examples with JSON are Mac/Linux-specific, do not work on Windows
- Dominant language
- Python
- Stars
- 17.3k
- Forks
- 4.6k
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 13
Description
Confirm by changing [ ] to [x] below to ensure that it's a bug:
- [x] I've gone though the [User Guide](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-welcome.html) and the [API reference](https://docs.aws.amazon.com/cli/latest/reference/)
- [x] I've searched for [previous similar issues](https://github.com/aws/aws-cli/issues) and didn't find any solution
**Describe the bug**
The awscli documentation includes examples of how to use each action, for example [here](https://docs.aws.amazon.com/cli/latest/reference/iam/tag-user.html#examples) (source is [here](https://github.com/aws/aws-cli/blob/develop/awscli/examples/iam/tag-user.rst)):
aws iam tag-user --user-name alice --tags '{"Key": "Department", "Value": "Accounting"}'
None of these examples that include JSON will run on Windows. All of them need to be modified to replace outer single quotes with double quotes and to escape embedded double quotes, for example as follows:
aws iam tag-user --user-name alice --tags "{\"Key\": \"Department\", \"Value\": \"Accounting\"}"
Advice about how to correctly quote JSON payloads on Windows is admittedly provided [here](https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-parameters-quoting-strings.html), but that's not at all obvious to the reader.
It would be great if you could provide some generic solution for all example invocations in the documentation. Perhaps you could leverage the browser's user agent here. Maybe add a small Copy button/icon that can be used to copy the sample command line, where the copied text is user agent-sensitive and provides a correctly-quoted example for the OS client in question. Or simply, dynamically inject a Windows-specific example for every example on every docs page (identified by some specific CSS class).
**SDK version number**
aws-cli/1.18.46 Python/3.6.0 Windows/10 botocore/1.15.46
**Platform/OS/Hardware/Device**
Windows 10
**To Reproduce (observed behavior)**
Go to an awscli doc page ([example of iam tag-user](https://docs.aws.amazon.com/cli/latest/reference/iam/tag-user.html))
Copy the example
Go to Windows CMD shell
Paste in the command, hit enter
Result will be as follows:
> Error parsing parameter '--tags': Expected: '=', received: ''' for input:
'{Key:
^
**Expected behavior**
The expected behavior is that the pasted command will be executed (and will likely fail for reasons beyond the scope of this problem report):
> An error occurred (NoSuchEntity) when calling the TagUser operation: The user with name alice cannot be found.
**Logs/output**
Get full traceback and error logs by adding `--debug` to the command.
**Additional context**
Add any other context about the problem here.
Contributor guide
Assessment
This issue has not been assessed yet.