home-assistant-ecosystem / home-assistant-cli

:computer: Command-line tool for Home Assistant
Other
446 stars 69 forks source link

Load json from stdin if --json is set to '-' #400

Closed pschmitt closed 1 year ago

pschmitt commented 1 year ago

I've been hitting ARG_MAX while editing my Lovelace dashboard with the following:

hass-cli raw ws lovelace/config/save --json=<VERY_LONG_JSON>

This PR allows reading it from stdin, as in:

printf '%s' <VERY_LONG_JSON> | hass-cli raw ws lovelace/config/save --json=-

Both still work, the latter just allows reading more data.