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

33 lines
1.2 KiB
Plaintext
Raw Normal View History

:: story: Attach a commit message (to the last commit by default)
::
:: Optionally takes a case and desk
2021-11-27 04:53:20 +03:00
::
::::
::
2022-01-30 23:58:35 +03:00
/- *story
2021-11-27 04:53:20 +03:00
:- %say
|= $: [now=@da eny=@uvJ bec=beak]
[[title=@t body=$@(~ [p=@t ~])] =desk cas=cash ~]
2021-11-27 04:53:20 +03:00
==
=/ our p.bec
=? desk =(*^desk desk) q.bec :: use current desk if user didn't provide
=? cas =(*case cas) r.bec :: use case from beak if cas not provided
?: !(~(has in .^((set ^desk) %cd /(scot %p our)/$/(scot %da now))) desk)
2023-05-05 00:22:44 +03:00
helm-pass+[%d %flog %text "Error: desk {<desk>} does not exist."]
2022-02-23 02:33:38 +03:00
=/ tak=tako:clay
?: ?=([%tako tako:clay] cas)
p.cas
2022-02-23 02:33:38 +03:00
?: !.^(? %cs /(scot %p our)/[desk]/(scot cas)/case)
~& >> "Error: invalid case {<cas>} provided"
!!
.^(tako:clay %cs /(scot %p our)/[desk]/(scot cas)/tako/~)
::
2022-02-23 02:11:55 +03:00
=/ pax /(scot %p our)/[desk]/(scot %da now)/story
2022-02-19 02:51:37 +03:00
?: !.^(? %cu pax)
2023-05-05 00:22:44 +03:00
helm-pass+[%d %flog %text "Error: No story file found. Please use |story-init to create one."]
=/ tale=story .^(story %cx /(scot %p our)/[desk]/(scot %da now)/story)
=/ =prose [title ?~(body '' p.body)]
=. tale (~(put ju tale) tak prose)
2021-11-27 04:53:20 +03:00
:- %helm-pass
2023-05-05 00:22:44 +03:00
[%c [%info desk %& [/story %ins story+!>(tale)]~]]