shrub/pkg/arvo/gen/hood/story-init.hoon

23 lines
821 B
Plaintext
Raw Normal View History

:: story: Create a story file for a given desk, optionally overwriting
2021-12-14 22:31:38 +03:00
::
::::
::
2022-01-30 23:58:35 +03:00
/- *story
2021-12-14 22:31:38 +03:00
:- %say
|= $: [now=@da eny=@uvJ bec=beak]
[[~] =desk overwrite=_| ~]
2021-12-14 22:31:38 +03:00
==
=/ our p.bec
2021-12-14 22:31:38 +03:00
=? desk =(*^desk desk) q.bec :: use current desk if user didn't provide
?: !(~(has in .^((set ^desk) %cd /(scot %p our)/$/(scot %da now))) desk)
~& >> "Error: desk {<desk>} does not exist."
helm-pass+[%d %noop ~]
=/ existing-story .^(? %cu /(scot %p our)/[desk]/(scot %da now)/story)
?: ?&(existing-story !overwrite)
~& >> "Error: /{(trip (slav %tas desk))}/story already exists."
~& >> "To forcibly overwrite, use `=overwrite %.y`"
2022-02-04 20:49:10 +03:00
:: XX could use a better way to noop
helm-pass+[%d %noop ~]
=| tale=story
2021-12-14 22:31:38 +03:00
:- %helm-pass
[%c [%info desk %& [/story %ins story+!>(tale)]~]]