[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
17/24: ui: Add 'run-guix'.
From: |
Alex Kost |
Subject: |
17/24: ui: Add 'run-guix'. |
Date: |
Fri, 28 Aug 2015 20:06:36 +0000 |
alezost pushed a commit to branch wip-emacs-popup-ui
in repository guix.
commit 40cd34d5f69a25262bf39154bd559e97f0cc739c
Author: Alex Kost <address@hidden>
Date: Sun Aug 16 10:28:04 2015 +0300
ui: Add 'run-guix'.
* guix/ui.scm (guix-main): Move the code to run guix command line to ...
(run-guix): ...here. New procedure. Export it.
---
guix/ui.scm | 49 +++++++++++++++++++++++++++----------------------
1 files changed, 27 insertions(+), 22 deletions(-)
diff --git a/guix/ui.scm b/guix/ui.scm
index a6d4fd1..e245b9a 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -2,7 +2,7 @@
;;; Copyright © 2012, 2013, 2014, 2015 Ludovic Courtès <address@hidden>
;;; Copyright © 2013 Mark H Weaver <address@hidden>
;;; Copyright © 2013 Nikita Karetnikov <address@hidden>
-;;; Copyright © 2014 Alex Kost <address@hidden>
+;;; Copyright © 2014, 2015 Alex Kost <address@hidden>
;;; Copyright © 2014 Deck Pickard <address@hidden>
;;;
;;; This file is part of GNU Guix.
@@ -77,6 +77,7 @@
args-fold*
parse-command-line
run-guix-command
+ run-guix
program-name
guix-warning-port
warning
@@ -1032,31 +1033,35 @@ found."
(parameterize ((program-name command))
(apply command-main args))))
+(define (run-guix . args)
+ "Run guix command defined by command line ARGS."
+ (define option? (cut string-prefix? "-" <>))
+
+ (match args
+ (()
+ (format (current-error-port)
+ (_ "guix: missing command name~%"))
+ (show-guix-usage))
+ ((or ("-h") ("--help"))
+ (show-guix-help))
+ (("--version")
+ (show-version-and-exit "guix"))
+ (((? option? o) args ...)
+ (format (current-error-port)
+ (_ "guix: unrecognized option '~a'~%") o)
+ (show-guix-usage))
+ (("help" args ...)
+ (show-guix-help))
+ ((command args ...)
+ (apply run-guix-command
+ (string->symbol command)
+ args))))
+
(define guix-warning-port
(make-parameter (current-warning-port)))
(define (guix-main arg0 . args)
(initialize-guix)
- (let ()
- (define (option? str) (string-prefix? "-" str))
- (match args
- (()
- (format (current-error-port)
- (_ "guix: missing command name~%"))
- (show-guix-usage))
- ((or ("-h") ("--help"))
- (show-guix-help))
- (("--version")
- (show-version-and-exit "guix"))
- (((? option? o) args ...)
- (format (current-error-port)
- (_ "guix: unrecognized option '~a'~%") o)
- (show-guix-usage))
- (("help" args ...)
- (show-guix-help))
- ((command args ...)
- (apply run-guix-command
- (string->symbol command)
- args)))))
+ (apply run-guix args))
;;; ui.scm ends here
- 03/24: emacs: Add and use 'guix-while-search'., (continued)
- 03/24: emacs: Add and use 'guix-while-search'., Alex Kost, 2015/08/28
- 04/24: emacs: Add and use 'guix-concat-strings'., Alex Kost, 2015/08/28
- 05/24: emacs: Add utils to make symbol and string for guix command., Alex Kost, 2015/08/28
- 07/24: emacs: Add 'guix-any'., Alex Kost, 2015/08/28
- 08/24: emacs: Add 'guix-memoized-defalias' macro., Alex Kost, 2015/08/28
- 09/24: guix lint: Export checkers and <lint-checker> accessors., Alex Kost, 2015/08/28
- 10/24: emacs: Add 'guix-lint-checker-names'., Alex Kost, 2015/08/28
- 11/24: guix graph: Export node types and <node-type> accessors., Alex Kost, 2015/08/28
- 12/24: emacs: Add 'guix-graph-type-names'., Alex Kost, 2015/08/28
- 13/24: emacs: Add 'guix-package-names'., Alex Kost, 2015/08/28
- 17/24: ui: Add 'run-guix'.,
Alex Kost <=
- 15/24: emacs: Add minibuffer readers., Alex Kost, 2015/08/28
- 18/24: emacs: Add code to run guix command in REPL., Alex Kost, 2015/08/28
- 14/24: emacs: Add help variables., Alex Kost, 2015/08/28
- 20/24: doc: Reorganize "Emacs Interface" node., Alex Kost, 2015/08/28
- 23/24: emacs: Use prompt for packages instead popup for edit action., Alex Kost, 2015/08/28
- 19/24: emacs: Add code to run guix command in shell., Alex Kost, 2015/08/28
- 21/24: emacs: Add "guix-popup.el"., Alex Kost, 2015/08/28
- 24/24: emacs: Use popup interface instead 'guix-pull' command., Alex Kost, 2015/08/28
- 16/24: emacs: Add and use alist accessors., Alex Kost, 2015/08/28
- 22/24: emacs: Add popup interface for guix commands., Alex Kost, 2015/08/28