Message ID | 20221202025641.9318-1-antero@mailbox.org |
---|---|
State | New |
Headers | show |
Series | [bug#59754] scripts: repl: Add --interactive and --list-types flags. | expand |
Hi, Thanks, nice! On Fri, 02 Dec 2022 at 02:56, Antero Mejr via Guix-patches via <guix-patches@gnu.org> wrote: > * guix/scripts/repl.scm (guix-repl): Honor -i, --interactive flag. > (%options): Add -i/--interactive and --l/--list-types. -^ Typo The patch LGTM, minor three comments. 1. I would not use the shortkey -l; only the long one. 2. I would move --list-types right before -t/--type --8<---------------cut here---------------start------------->8--- --list-types display REPL types and exit -t, --type=TYPE start a REPL of the given TYPE --listen=ENDPOINT listen to ENDPOINT instead of standard input -q inhibit loading of ~/.guile -i, --interactive launch REPL after evaluating FILE -L, --load-path=DIR prepend DIR to the package module search path -h, --help display this help and exit -V, --version display version information and exit --8<---------------cut here---------------end--------------->8--- 3. I would split the addition of --list-types and --interactive in two separated commits. But for each option, I would also change the manual with the same commit. Else, please squash this submission. :-) Cheers, simon
zimoun <zimon.toutoune@gmail.com> writes: > Hi, > > Thanks, nice! > > The patch LGTM, minor three comments. Split up the commits and made the suggested fixes. Thanks for the review!
diff --git a/guix/scripts/repl.scm b/guix/scripts/repl.scm index 50d18c7760..eac3d7264e 100644 --- a/guix/scripts/repl.scm +++ b/guix/scripts/repl.scm @@ -52,12 +52,19 @@ (define %options (option '(#\t "type") #t #f (lambda (opt name arg result) (alist-cons 'type (string->symbol arg) result))) + (option '(#\l "list-types") #f #f + (lambda (opt name arg result) + (display (string-join '("guile" "machine") "\n" 'suffix)) + (exit 0))) (option '("listen") #t #f (lambda (opt name arg result) (alist-cons 'listen arg result))) (option '(#\q) #f #f (lambda (opt name arg result) (alist-cons 'ignore-dot-guile? #t result))) + (option '(#\i "interactive") #f #f + (lambda (opt name arg result) + (alist-cons 'interactive? #t result))) (option '(#\L "load-path") #t #f (lambda (opt name arg result) ;; XXX: Imperatively modify the search paths. @@ -78,9 +85,15 @@ (define (show-help) -q inhibit loading of ~/.guile")) (newline) (display (G_ " + -i, --interactive launch REPL after evaluating FILE")) + (newline) + (display (G_ " -L, --load-path=DIR prepend DIR to the package module search path")) (newline) (display (G_ " + -l, --list-types display REPL types and exit")) + (newline) + (display (G_ " -h, --help display this help and exit")) (display (G_ " -V, --version display version information and exit")) @@ -190,7 +203,7 @@ (define script ;; file in %LOAD-PATH. Thus, pass (getcwd) instead of ".". (load-in-vicinity (getcwd) (car script))))) - (when (null? script) + (when (or (null? script) (assoc-ref opts 'interactive?)) ;; Start REPL (let ((type (assoc-ref opts 'type))) (call-with-connection (assoc-ref opts 'listen)