From ee1c3d8fb595831df3dcc5da847b2f32b3d0127c Mon Sep 17 00:00:00 2001 From: Steve Tooke Date: Fri, 15 Sep 2023 14:43:40 +0100 Subject: [PATCH] Add documentation for relative datetime snappish --- cmd/kosli/diffSnapshots.go | 9 ++++++++- cmd/kosli/getSnapshot.go | 10 ++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/cmd/kosli/diffSnapshots.go b/cmd/kosli/diffSnapshots.go index c437bfeed..804cf42f4 100644 --- a/cmd/kosli/diffSnapshots.go +++ b/cmd/kosli/diffSnapshots.go @@ -18,6 +18,8 @@ const diffSnapshotsDesc = diffSnapshotsDescShort + ` Specify SNAPPISH_1 and SNAPPISH_2 by: - environmentName~ N'th behind the latest snapshot - environmentName# snapshot number N +- environmentName@{YYYY-MM-DDTHH:MM:SS} snapshot at specific moment in time in UTC +- environmentName@{..ago} snapshot at a relative time - environmentName the latest snapshot` const diffSnapshotsExample = ` @@ -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 diff --git a/cmd/kosli/getSnapshot.go b/cmd/kosli/getSnapshot.go index d3e57f80d..207960f15 100644 --- a/cmd/kosli/getSnapshot.go +++ b/cmd/kosli/getSnapshot.go @@ -78,6 +78,7 @@ Specify SNAPPISH by: - environmentName~ N'th behind the latest snapshot - environmentName# snapshot number N - environmentName@{YYYY-MM-DDTHH:MM:SS} snapshot at specific moment in time in UTC +- environmentName@{..ago} snapshot at a relative time - environmentName the latest snapshot` const getSnapshotExample = ` @@ -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)