mirror of
https://github.com/urbit/shrub.git
synced 2024-12-11 11:02:25 +03:00
gen: warn and prompt for confirmation in |code %reset
This commit is contained in:
parent
d0be435624
commit
8e855b159f
@ -3,15 +3,14 @@
|
||||
:::: /hoon/code/hood/gen
|
||||
::
|
||||
/? 310
|
||||
::
|
||||
::::
|
||||
::
|
||||
:- %say
|
||||
/- *sole
|
||||
/+ *generators
|
||||
:- %ask
|
||||
|= $: [now=@da eny=@uvJ bec=beak]
|
||||
[arg=?(~ [%reset ~]) ~]
|
||||
==
|
||||
=* our p.bec
|
||||
:- %helm-code
|
||||
^- (sole-result [%helm-code ?(~ %reset)])
|
||||
?~ arg
|
||||
=/ code=tape
|
||||
%+ slag 1
|
||||
@ -20,11 +19,23 @@
|
||||
=/ step=tape
|
||||
%+ scow %ud
|
||||
.^(@ud %j /(scot %p our)/step/(scot %da now)/(scot %p our))
|
||||
%- %- slog
|
||||
:~ [%leaf code]
|
||||
[%leaf (weld "current step=" step)]
|
||||
[%leaf "use |code %reset to invalidate this and generate a new code"]
|
||||
==
|
||||
~
|
||||
::
|
||||
%+ print 'use |code %reset to invalidate this and generate a new code'
|
||||
%+ print leaf+(weld "current step=" step)
|
||||
%+ print leaf+code
|
||||
(produce [%helm-code ~])
|
||||
::
|
||||
?> =(%reset -.arg)
|
||||
%reset
|
||||
%+ print 'continue?'
|
||||
%+ print 'warning: resetting your code closes all web sessions'
|
||||
%+ prompt
|
||||
[%& %project "y/n: "]
|
||||
%+ parse
|
||||
;~ pose
|
||||
(cold %.y ;~(pose (just 'y') (just 'Y')))
|
||||
(cold %.n ;~(pose (just 'n') (just 'N')))
|
||||
==
|
||||
|= reset=?
|
||||
?. reset
|
||||
no-product
|
||||
(produce [%helm-code %reset])
|
||||
|
Loading…
Reference in New Issue
Block a user