Skip to content

Commit ebd7506

Browse files
authored
Merge pull request #5 from clear-code/sf/dryrun
Add a new option '--dryrun'
2 parents 39715d5 + 490fd72 commit ebd7506

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

report.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,21 @@ def format_message(config, cost, forecast):
4141
return template.format(year=today.year, month=today.month, day=today.day,
4242
cost=cost, forecast=forecast)
4343

44-
def main(aws_profile_name = "default"):
44+
def main(aws_profile_name = "default", dryrun=False):
4545
config = load_config()
4646
cost, forecast = get_monthly_cost(config, aws_profile_name)
4747
message = format_message(config, cost, forecast)
48-
send_message(config, message)
48+
if dryrun:
49+
print(message)
50+
else:
51+
send_message(config, message)
4952

5053
if __name__ == '__main__':
5154
parser = argparse.ArgumentParser()
5255
parser.add_argument("--aws-profile", type=str, default="default",
5356
help="AWS profile name. Default: 'default'.")
57+
parser.add_argument("--dryrun", action='store_true',
58+
help="For debug. Print the message to stdout.")
5459
args = parser.parse_args()
5560

56-
main(args.aws_profile)
61+
main(args.aws_profile, dryrun=args.dryrun)

0 commit comments

Comments
 (0)