Skip to content

Commit

Permalink
Add documentation for relative datetime snappish
Browse files Browse the repository at this point in the history
  • Loading branch information
tooky committed Sep 15, 2023
1 parent 88cbf77 commit ee1c3d8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
9 changes: 8 additions & 1 deletion cmd/kosli/diffSnapshots.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ const diffSnapshotsDesc = diffSnapshotsDescShort + `
Specify SNAPPISH_1 and SNAPPISH_2 by:
- environmentName~<N> N'th behind the latest snapshot
- environmentName#<N> snapshot number N
- environmentName@{YYYY-MM-DDTHH:MM:SS} snapshot at specific moment in time in UTC
- environmentName@{<N>.<hours|days|weeks|months>.ago} snapshot at a relative time
- environmentName the latest snapshot`

const diffSnapshotsExample = `
Expand All @@ -35,7 +37,12 @@ kosli diff snapshots envName1 envName2 \
kosli diff snapshots envName1 envName2 \
--show-unchanged \
--api-token yourAPIToken \
--org orgName`
--org orgName
# compare the snapshot from 2 weeks ago in an environment to the latest
kosli diff snapshots envName@{2.weeks.ago} envName \
--api-token yourAPIToken \
--org orgName`

type diffSnapshotsOptions struct {
output string
Expand Down
10 changes: 8 additions & 2 deletions cmd/kosli/getSnapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ Specify SNAPPISH by:
- environmentName~<N> N'th behind the latest snapshot
- environmentName#<N> snapshot number N
- environmentName@{YYYY-MM-DDTHH:MM:SS} snapshot at specific moment in time in UTC
- environmentName@{<N>.<hours|days|weeks|months>.ago} snapshot at a relative time
- environmentName the latest snapshot`

const getSnapshotExample = `
Expand All @@ -96,10 +97,15 @@ kosli get snapshot yourEnvironmentName#23
--api-token yourAPIToken \
--org yourOrgName
# get an environment snapshot at midday (UTC), on valentine's day of 2023:
# get the environment snapshot at midday (UTC), on valentine's day of 2023:
kosli get snapshot yourEnvironmentName@{2023-02-14T12:00:00}
--api-token yourAPIToken \
--org yourOrgName`
--org yourOrgName
# get the environment snapshot based on a relative time:
kosli get snapshot yourEnvironmentName@{3.weeks.ago}
--api-token yourAPIToken \
--org yourOrgName`

func newGetSnapshotCmd(out io.Writer) *cobra.Command {
o := new(environmentGetOptions)
Expand Down

0 comments on commit ee1c3d8

Please sign in to comment.