ksuid-cli
A Command Line Interface for dealing with Segment's KSUIDs.
Uses Mark Wubben's KSUID node.js library.
Installation
$ npm install ksuid-cli
This package comes with a simple command-line tool ksuid
. This tool can
generate KSUIDs as well as inspect the internal components for debugging
purposes.
Usage examples
Generate 4 KSUIDs
> ksuid -n 4151zKb0yBE31siVu9GYmpi1vlfe151zKUmtgUA8kRSgg5Q6tG6vqPx151zKTalsFp5ddmaiEaXu7l3YTD151zKUVLrYKQ1p6XNDRPIFbrN1w
Inspect the components of a KSUID
Using the inspect formatting on just 1 ksuid:
> ksuid -f inspect REPRESENTATION: String: 151zOCJ2I9szGtX4VwDJjnmvrpZ Raw: 0793CB58A38B910C80235B72A6F6B5DF5CA3C929 COMPONENTS: Time: 2018-05-24T01:46:00.000Z Timestamp: 127126360 Payload: A38B910C80235B72A6F6B5DF5CA3C929
Using the template formatting on 4 ksuid:
> ksuid -f template -t '{{ .Time }}: {{ .Payload }}' -n 42018-05-24T01:46:31.000Z: B34547537772BBC0E2F29CACFC0BB5C22018-05-24T01:46:31.000Z: 79A4B61465263502F6F6B3D686F3B48E2018-05-24T01:46:31.000Z: DBBF7F076962352AD8D60D45A34F54992018-05-24T01:46:31.000Z: B00E173900EBB05D768CADF13C3583D0
Generate detailed versions of new KSUID
Generate a new KSUID with the corresponding time using the time formatting:
> ksuid -f time -v151zVo4Jr8dajx0fqHWAPxDbHRs: 2018-05-24T01:47:01.000Z
Generate 4 new KSUID with details using template formatting:
> ksuid -f template -t '{ "timestamp": "{{ .Timestamp }}", "payload": "{{ .Payload }}", "ksuid": "{{.String}}"}' -n 4
Display the detailed version of a new KSUID:
> ksuid -f inspect REPRESENTATION: String: 151zbEzzY29y1EMfAycgv4kZTod Raw: 0793CBC06EA61F24424C8C6ED6DD3C7540AB013F COMPONENTS: Time: 2018-05-24T01:47:44.000Z Timestamp: 127126464 Payload: 6EA61F24424C8C6ED6DD3C7540AB013F