Skip to content

Commit

Permalink
Lint codes
Browse files Browse the repository at this point in the history
  • Loading branch information
Rindrics committed Jun 11, 2024
1 parent 4693d21 commit b975410
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 5 deletions.
12 changes: 11 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
## aws-cost-cli

> CLI tool to perform cost analysis on your AWS account with Slack integration
![](.github/images/aws-cost.gif)
Expand All @@ -13,7 +14,7 @@ npm install -g aws-cost-cli

## Usage

For the simple usage, just run the command without any options.
For the simple usage, just run the command without any options.

```
aws-cost
Expand Down Expand Up @@ -63,36 +64,43 @@ aws-cost
To configure the credentials using aws-cli, have a look at the [aws-cli docs](https://github.com/aws/aws-cli#configuration) for more information.

## Detailed Breakdown

> The default usage is to get the cost breakdown by service
```bash
aws-cost
```

You will get the following output

![Default Usage](./.github/images/default-demo.gif)

## Total Costs

> You can also get the summary of the cost without the service breakdown
```bash
aws-cost --summary
```

You will get the following output

![Summary Usage](./.github/images/summary-demo.gif)

## Plain Text

> You can also get the output as plain text
```bash
aws-cost --text
```

You will get the following output in response

![Text Usage](./.github/images/text-usage.png)

## JSON Output

> You can also get the output as JSON
```bash
Expand Down Expand Up @@ -151,6 +159,7 @@ aws-cost --json
}
}
```

</details>

## Slack Integration
Expand Down Expand Up @@ -191,4 +200,5 @@ Regarding the credentials, you need to have the following permissions in order t
Also, please note that this tool uses AWS Cost Explorer under the hood which [costs $0.01 per request](https://aws.amazon.com/aws-cost-management/aws-cost-explorer/pricing/).

## License

MIT &copy; [Kamran Ahmed](https://twitter.com/kamranahmedse)
1 change: 0 additions & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import fs from 'node:fs';
import { loadSharedConfigFiles } from '@aws-sdk/shared-ini-file-loader';
import chalk from 'chalk';
import { printFatalError } from './logger';
Expand Down
2 changes: 1 addition & 1 deletion src/printers/fancy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export function printFancy(
`${serviceHeader} ${lastMonthHeader} ${thisMonthHeader} ${last7DaysHeader} ${yesterdayHeader}`,
);

for (let service of sortedServiceNames) {
for (const service of sortedServiceNames) {
const serviceLabel = chalk.cyan(service.padStart(maxServiceLength));
const lastMonthTotal = chalk.green(
`$${serviceCosts.lastMonth[service].toFixed(2)}`.padEnd(headerPadLength),
Expand Down
2 changes: 1 addition & 1 deletion src/printers/slack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export async function notifySlack(
const totals = costs.totals;
const serviceCosts = costs.totalsByService;

let serviceCostsYesterday = [];
const serviceCostsYesterday = [];
Object.keys(serviceCosts.yesterday).forEach((service) => {
serviceCosts.yesterday[service].toFixed(2);
serviceCostsYesterday.push(
Expand Down
1 change: 0 additions & 1 deletion src/printers/text.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { TotalCosts } from '../cost';
import { hideSpinner } from '../logger';
import { printPlainSummary } from './text';

describe('printPlainSummary', () => {
Expand Down

0 comments on commit b975410

Please sign in to comment.