-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreadme.py
executable file
·112 lines (83 loc) · 3.3 KB
/
readme.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#!/usr/bin/env python3
from subprocess import PIPE, run
BASE_TEMPLATE = """\
<!-- Generated by readme.py, do not edit. -->
# awsx
awsx is a command-line utility providing helpful commands that the default AWS CLI does not provide.
It does not replace the AWS CLI, rather it is meant to work in conjunction with it.
## Usage
{usage}\
"""
USAGE_TEMPLATE = """\
### awsx {subcommand}
```
{subcommand_usage}
```
"""
LICENSE_FOOTER = """\
## License
awsx is licensed under the Apache License, Version 2.0, (see [LICENSE](LICENSE) or <https://www.apache.org/licenses/LICENSE-2.0>).
awsx internally makes use of various open-source projects.
You can find a full list of these projects and their licenses in [THIRD_PARTY_LICENSES.md](THIRD_PARTY_LICENSES.md).
### Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in awsx by you, as defined in the Apache-2.0 license, shall be licensed under the Apache License, Version 2.0, without any additional terms or conditions.
We require code submitted to be formatted with Rust's default rustfmt formatter (CI will automatically verified if your code is formatted correctly).
We are using unstable rustfmt formatting rules, which requires running the formatter with a nightly toolchain, which you can do as follows:
```sh
$ rustup toolchain install nightly
$ cargo +nightly fmt
```
(Building and running awsx itself can and should happen with the stable toolchain.)
Additionally we are also checking whether there are any clippy warnings in your code.
You can run clippy locally with:
```sh
$ cargo clippy --workspace --lib --bins --tests --all-targets -- -Dwarnings
```
There can be occasions where newer versions of clippy warn about code you haven't touched.
In such cases we'll try to get those warnings resolved before merging your changes, or work together with you to get them resolved in your merge request.
## Affiliation
This project has no official affiliation with Amazon Web Services, Inc., Amazon.com, Inc., or any of its affiliates.
"Amazon Web Services" is a trademark of Amazon.com, Inc. or its affiliates in the United States and/or other countries.
awsx is a command-line utility is meant as an AWS CLI extension, providing features we are missing.
"""
SUBCOMMANDS = [
"create-stack",
"find-amis-inuse",
"find-auto-scaling-group",
"find-cloudfront-distribution",
"find-db-cluster-snapshot",
"find-db-snapshot",
"find-target-group",
"identify-new-parameters",
"override-parameters",
"update-deployed-template",
"verify-changes-compatible",
"verify-parameter-file",
]
def main():
usage = ""
main_usage = run(
["cargo", "run", "--", "--help"],
stdout=PIPE,
).stdout.decode("utf-8")
usage += USAGE_TEMPLATE.format(
subcommand="",
subcommand_usage=main_usage.rstrip(),
)
for subcommand in SUBCOMMANDS:
subcommand_usage = run(
["cargo", "run", "--", subcommand, "--help"],
stdout=PIPE,
).stdout.decode("utf-8")
usage += USAGE_TEMPLATE.format(
subcommand=subcommand,
subcommand_usage=subcommand_usage.rstrip(),
)
usage += LICENSE_FOOTER
print(
BASE_TEMPLATE.format(
usage=usage,
)
)
if __name__ == "__main__":
main()