endojs / endo

Endo is a distributed secure JavaScript sandbox, based on SES
Apache License 2.0
768 stars 68 forks source link

feat(cli): Expand options for storing values #2237

Closed kriskowal closed 2 months ago

kriskowal commented 2 months ago

In, https://github.com/endojs/endo/pull/2226 we gain the ability to marshal copy data and remotables that are backed by formulas.

This change surfaces these features to the CLI by exposing a variety of flags.

> endo store --json '{"hello": "world"}' --name greeting
> endo show greeting
{ hello: 'world' }
> endo store --text 'Hello, World!' --name greeting
> endo show greeting
Hello, World!
> endo store --bigint 42 --name meaningful-bigint
> endo show meaningful-bigint
42n
> endo store --json-stdin --name greeting < <(jq -n '{hello:"world"}')
> endo show greeting
{ hello: 'world' }
> endo store --text-stdin --name greeting < <(echo hi)
> endo show greeting
hi
> endo store --stdin --name greeting < <(echo hi)
> endo show greeting
Object [Alleged: Readable file with SHA-512 d78abb05...] {}
> endo cat greeting
hi
rekmarks commented 2 months ago

~Additionally: endo store --json '{hello: "world"}' --name greeting fails on my system with the following error (all other examples succeed):~

Edit: Typo in example.