mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-25 07:52:59 +03:00
bad5013c8a
If a desk already existed, we would crash the generator, embedding a message in the resulting stack trace. To improve legibility, we turn this into an %ask generator, prompting only if we are about to overwrite an existing desk. We also update the =force argument to be =hard instead, to match |nuke.
51 lines
964 B
Plaintext
51 lines
964 B
Plaintext
:: |new-desk: creates a minimal desk
|
|
::
|
|
/+ *generators
|
|
::
|
|
:- %ask
|
|
|= $: [now=@da eny=@uvJ bek=beak]
|
|
[=desk ~]
|
|
[from=$~(%base desk) hard=_|]
|
|
==
|
|
::
|
|
=; make-new-desk
|
|
?. ?& !hard
|
|
(~(has in .^((set ^desk) %cd (en-beam bek(q %$) /))) desk)
|
|
==
|
|
(make-new-desk)
|
|
%+ print (rap 3 'the desk %' desk ' already exists. overwrite it?' ~)
|
|
%+ prompt [%& %prompt "overwrite? (y/N) "]
|
|
|= in=tape
|
|
?. |(=("y" in) =("Y" in) =("yes" in))
|
|
no-product
|
|
(make-new-desk)
|
|
::
|
|
|. %- produce
|
|
:- %helm-pass
|
|
%^ new-desk:cloy desk
|
|
~
|
|
%- ~(gas by *(map path page:clay))
|
|
|^ =- (turn - mage)
|
|
^- (list path)
|
|
:~ /mar/noun/hoon
|
|
/mar/hoon/hoon
|
|
/mar/txt/hoon
|
|
/mar/kelvin/hoon
|
|
/sys/kelvin
|
|
==
|
|
::
|
|
++ mage
|
|
|= =path
|
|
:- path
|
|
^- page:clay
|
|
:- (rear path)
|
|
~| [%missing-source-file from path]
|
|
.^ *
|
|
%cx
|
|
(scot %p p.bek)
|
|
from
|
|
(scot %da now)
|
|
path
|
|
==
|
|
--
|