2022-03-11 20:08:40 +03:00
|
|
|
:: 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]
|
2022-01-20 23:56:47 +03:00
|
|
|
[[~] =desk overwrite=_| ~]
|
2021-12-14 22:31:38 +03:00
|
|
|
==
|
2022-02-06 04:44:26 +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
|
2022-02-22 06:13:15 +03:00
|
|
|
?: !(~(has in .^((set ^desk) %cd /(scot %p our)/$/(scot %da now))) desk)
|
2023-05-05 00:17:50 +03:00
|
|
|
helm-pass+[%d %flog %text "Error: desk {<desk>} does not exist."]
|
2022-02-06 04:44:26 +03:00
|
|
|
=/ existing-story .^(? %cu /(scot %p our)/[desk]/(scot %da now)/story)
|
2022-01-20 23:56:47 +03:00
|
|
|
?: ?&(existing-story !overwrite)
|
2023-05-05 00:17:50 +03:00
|
|
|
:- %helm-pass
|
|
|
|
[%d %flog %text "Error: /{(trip (slav %tas desk))}/story already exists. To forcibly overwrite, use `=overwrite %.y`"]
|
2022-01-20 23:56:47 +03:00
|
|
|
=| tale=story
|
2021-12-14 22:31:38 +03:00
|
|
|
:- %helm-pass
|
2023-05-05 00:17:50 +03:00
|
|
|
[%c [%info desk %& [/story %ins story+!>(tale)]~]]
|