mirror of
https://github.com/jbranchaud/til
synced 2026-01-21 07:58:02 +00:00
Compare commits
3 Commits
5f556d18c3
...
400d7b9f19
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
400d7b9f19 | ||
|
|
db07125ba9 | ||
|
|
295fe153ad |
@@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
|
|||||||
|
|
||||||
For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186).
|
For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186).
|
||||||
|
|
||||||
_1627 TILs and counting..._
|
_1628 TILs and counting..._
|
||||||
|
|
||||||
See some of the other learning resources I work on:
|
See some of the other learning resources I work on:
|
||||||
- [Ruby Operator Lookup](https://www.visualmode.dev/ruby-operators)
|
- [Ruby Operator Lookup](https://www.visualmode.dev/ruby-operators)
|
||||||
@@ -114,6 +114,7 @@ If you've learned something here, support my efforts writing daily TILs by
|
|||||||
|
|
||||||
- [AWS CLI Requires Groff Executable](aws/aws-cli-requires-groff-executable.md)
|
- [AWS CLI Requires Groff Executable](aws/aws-cli-requires-groff-executable.md)
|
||||||
- [Find And Follow Server Logs](aws/find-and-follow-server-logs.md)
|
- [Find And Follow Server Logs](aws/find-and-follow-server-logs.md)
|
||||||
|
- [Output CLI Results In Different Formats](aws/output-cli-results-in-different-formats.md)
|
||||||
- [Sign Up User With Email And Password](aws/sign-up-user-with-email-and-password.md)
|
- [Sign Up User With Email And Password](aws/sign-up-user-with-email-and-password.md)
|
||||||
- [SSH Into An ECS Container](aws/ssh-into-an-ecs-container.md)
|
- [SSH Into An ECS Container](aws/ssh-into-an-ecs-container.md)
|
||||||
- [Turn Off Output Pager For A Command](aws/turn-off-output-pager-for-a-command.md)
|
- [Turn Off Output Pager For A Command](aws/turn-off-output-pager-for-a-command.md)
|
||||||
|
|||||||
49
aws/output-cli-results-in-different-formats.md
Normal file
49
aws/output-cli-results-in-different-formats.md
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
# Output CLI Results In Different Formats
|
||||||
|
|
||||||
|
The AWS CLI can output the results of commands in three different formats.
|
||||||
|
|
||||||
|
- Text
|
||||||
|
- JSON
|
||||||
|
- Table
|
||||||
|
|
||||||
|
The _default_ output format for my AWS CLI is currently configured to `json`.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ aws configure get output
|
||||||
|
json
|
||||||
|
```
|
||||||
|
|
||||||
|
I can either accept the default or I can override it with the `--output` flag.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ aws rds describe-db-instances \
|
||||||
|
--query 'DBInstances[*].Endpoint' \
|
||||||
|
--no-cli-pager
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"Address": "fc-database-abcefg-ab1c23de.asdfgh4zxcvb.us-east-2.rds.amazonaws.com",
|
||||||
|
"Port": 5432,
|
||||||
|
"HostedZoneId": "A1BCDE2FG345H6"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
$ aws rds describe-db-instances \
|
||||||
|
--query 'DBInstances[*].Endpoint' \
|
||||||
|
--no-cli-pager \
|
||||||
|
--output table
|
||||||
|
----------------------------------------------------------------------------------------------------
|
||||||
|
| DescribeDBInstances |
|
||||||
|
+-----------------------------------------------------------------------+-----------------+--------+
|
||||||
|
| Address | HostedZoneId | Port |
|
||||||
|
+-----------------------------------------------------------------------+-----------------+--------+
|
||||||
|
| fc-database-abcefg-ab1c23de.asdfgh4zxcvb.us-east-2.rds.amazonaws.com | A1BCDE2FG345H6 | 5432 |
|
||||||
|
+-----------------------------------------------------------------------+-----------------+--------+
|
||||||
|
|
||||||
|
$ aws rds describe-db-instances \
|
||||||
|
--query 'DBInstances[*].Endpoint' \
|
||||||
|
--no-cli-pager \
|
||||||
|
--output text
|
||||||
|
fc-database-abcefg-ab1c23de.asdfgh4zxcvb.us-east-2.rds.amazonaws.com A1BCDE2FG345H6 5432
|
||||||
|
```
|
||||||
|
|
||||||
|
[source](https://docs.aws.amazon.com/cli/v1/userguide/cli-usage-output-format.html)
|
||||||
@@ -5,6 +5,8 @@ an array-like object with all of the arguments to the function. Even if not
|
|||||||
all of the arguments are referenced in the function signature, they can
|
all of the arguments are referenced in the function signature, they can
|
||||||
still be accessed via the `arguments` object.
|
still be accessed via the `arguments` object.
|
||||||
|
|
||||||
|
> For ES6+ compatibility, the `spread` operator used via [rest parameters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters) is preferred over the `arugments` object when accessing an abritrary number of function arguments.
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
function argTest(one) {
|
function argTest(one) {
|
||||||
console.log(one);
|
console.log(one);
|
||||||
|
|||||||
Reference in New Issue
Block a user