bash-my-aws / bash-my-aws

Bash-my-AWS provides simple but powerful CLI commands for managing AWS resources

Home Page:https://bash-my-aws.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

trim timestamps

mbailey opened this issue · comments

We could reduce line width by shaving the ends off timestamps when listing a resource:

  • remove seconds and miliseconds

Any cons?

2019-05-06T06:39:05.510Z  2019-05-10T03:17:14.772Z

not sure about seconds, but definitely could remove milliseconds.
thanks.

awscli-v2 increased timestamp length by 8 chars

We gotta trim them!

aws/aws-cli#5045

Should still be done

This might be hard to do with jmespath as there is no slice or split function at the moment.

jmespath/jmespath.jep#5
jmespath/jmespath.jep#3

There is a jq option if we want to split on the characters T (to get only date) or . (to remove milliseconds)

https://unix.stackexchange.com/a/370328

This will trim them:

$ stacks | sed 's/\([0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}T[0-9]\{2\}:[0-9]\{2\}:[0-9]\{2\}\)\S*/\1/g'

docker-stack-bash-my-aws  CREATE_FAILED    2020-03-12T12:19:48  NEVER_UPDATED  NOT_NESTED
elbv2                     CREATE_COMPLETE  2021-03-09T13:38:08  NEVER_UPDATED  NOT_NESTED

Much better than without:

$ stacks
docker-stack-bash-my-aws  CREATE_FAILED    2020-03-12T12:19:48.446000+00:00  NEVER_UPDATED  NOT_NESTED
elbv2                     CREATE_COMPLETE  2021-03-09T13:38:08.326000+00:00  NEVER_UPDATED  NOT_NESTED