From 71c7d315a9518a1735777d524cebd15688b3dfa5 Mon Sep 17 00:00:00 2001 From: fang Date: Mon, 25 Oct 2021 16:20:34 +0200 Subject: [PATCH 1/6] gen: add |new-desk for creating minimal desks Includes the bare minimum of necessary files. --- pkg/arvo/gen/hood/new-desk.hoon | 35 +++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 pkg/arvo/gen/hood/new-desk.hoon diff --git a/pkg/arvo/gen/hood/new-desk.hoon b/pkg/arvo/gen/hood/new-desk.hoon new file mode 100644 index 0000000000..627e8fd69f --- /dev/null +++ b/pkg/arvo/gen/hood/new-desk.hoon @@ -0,0 +1,35 @@ +:: |new-desk: creates a minimal desk +:: +:- %say +|= $: [now=@da eny=@uvJ bek=beak] + [=desk ~] + from=$~(%base desk) + == +:: +?: (~(has in .^((set ^desk) %cd (en-beam bek(q from) /))) desk) + ~| [%already-exists desk] + !! +:: +=+ .^(=dome:clay %cv (en-beam bek /)) +:: +:- %helm-pass +%^ new-desk:cloy desk + ~ +%- ~(gas by *(map path page:clay)) +|^ =- (turn - mage) + ^- (list path) + :~ /mar/noun/hoon + /mar/hoon/hoon + /mar/kelvin/hoon + /sys/kelvin + == +:: +++ mage + |= =path + :- path + ^- page:clay + =; =cage [p q.q]:cage + ~| [%missing-source-file from path] + (need (~(get an:cloy ank.dome) path)) +-- + From beebc5fe0ef8efca6ea6f68420825d43559ce138 Mon Sep 17 00:00:00 2001 From: fang Date: Fri, 29 Oct 2021 11:28:19 +0200 Subject: [PATCH 2/6] gen: |new-desk -> |make-desk --- pkg/arvo/gen/hood/{new-desk.hoon => make-desk.hoon} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename pkg/arvo/gen/hood/{new-desk.hoon => make-desk.hoon} (100%) diff --git a/pkg/arvo/gen/hood/new-desk.hoon b/pkg/arvo/gen/hood/make-desk.hoon similarity index 100% rename from pkg/arvo/gen/hood/new-desk.hoon rename to pkg/arvo/gen/hood/make-desk.hoon From 3ad84e3afd7c28ffe8fe3ba25598f022883e85db Mon Sep 17 00:00:00 2001 From: fang Date: Tue, 4 Jan 2022 15:58:37 +0100 Subject: [PATCH 3/6] make-desk: include /mar/txt --- pkg/arvo/gen/hood/make-desk.hoon | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/arvo/gen/hood/make-desk.hoon b/pkg/arvo/gen/hood/make-desk.hoon index 627e8fd69f..ecb2e1f09e 100644 --- a/pkg/arvo/gen/hood/make-desk.hoon +++ b/pkg/arvo/gen/hood/make-desk.hoon @@ -20,6 +20,7 @@ ^- (list path) :~ /mar/noun/hoon /mar/hoon/hoon + /mar/txt/hoon /mar/kelvin/hoon /sys/kelvin == From d260f391eafa573f47daa0eddc7643d8219b28b9 Mon Sep 17 00:00:00 2001 From: fang Date: Wed, 1 Jun 2022 20:19:13 +0200 Subject: [PATCH 4/6] gen: |make-desk -> |new-desk User survey (sample size: 2) suggests |new-desk is the more ergonomic name. --- pkg/arvo/gen/hood/{make-desk.hoon => new-desk.hoon} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename pkg/arvo/gen/hood/{make-desk.hoon => new-desk.hoon} (100%) diff --git a/pkg/arvo/gen/hood/make-desk.hoon b/pkg/arvo/gen/hood/new-desk.hoon similarity index 100% rename from pkg/arvo/gen/hood/make-desk.hoon rename to pkg/arvo/gen/hood/new-desk.hoon From 49ad8726294bdcc5ff00966d4d3a5e291b7a73b4 Mon Sep 17 00:00:00 2001 From: fang Date: Wed, 1 Jun 2022 20:20:18 +0200 Subject: [PATCH 5/6] gen: in |new-desk, fetch files individually The ankh is no longer included in the dome, so we must scry out files one by one. --- pkg/arvo/gen/hood/new-desk.hoon | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/pkg/arvo/gen/hood/new-desk.hoon b/pkg/arvo/gen/hood/new-desk.hoon index ecb2e1f09e..e1fe588d16 100644 --- a/pkg/arvo/gen/hood/new-desk.hoon +++ b/pkg/arvo/gen/hood/new-desk.hoon @@ -10,8 +10,6 @@ ~| [%already-exists desk] !! :: -=+ .^(=dome:clay %cv (en-beam bek /)) -:: :- %helm-pass %^ new-desk:cloy desk ~ @@ -29,8 +27,13 @@ |= =path :- path ^- page:clay - =; =cage [p q.q]:cage + :- (rear path) ~| [%missing-source-file from path] - (need (~(get an:cloy ank.dome) path)) + .^ * + %cx + (scot %p p.bek) + from + (scot %da now) + path + == -- - From bad5013c8a008ccf37761fbff63e4b04c4fca95b Mon Sep 17 00:00:00 2001 From: fang Date: Wed, 1 Jun 2022 20:21:27 +0200 Subject: [PATCH 6/6] gen: in |new-desk, prompt instead of crash 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. --- pkg/arvo/gen/hood/new-desk.hoon | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/pkg/arvo/gen/hood/new-desk.hoon b/pkg/arvo/gen/hood/new-desk.hoon index e1fe588d16..54995a5979 100644 --- a/pkg/arvo/gen/hood/new-desk.hoon +++ b/pkg/arvo/gen/hood/new-desk.hoon @@ -1,15 +1,26 @@ :: |new-desk: creates a minimal desk :: -:- %say +/+ *generators +:: +:- %ask |= $: [now=@da eny=@uvJ bek=beak] [=desk ~] - from=$~(%base desk) + [from=$~(%base desk) hard=_|] == :: -?: (~(has in .^((set ^desk) %cd (en-beam bek(q from) /))) desk) - ~| [%already-exists desk] - !! +=; 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 ~