[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
13/20: ui: Add 'run-guix'.
From: |
Alex Kost |
Subject: |
13/20: ui: Add 'run-guix'. |
Date: |
Tue, 18 Aug 2015 09:41:12 +0000 |
alezost pushed a commit to branch wip-emacs-popup-ui
in repository guix.
commit 87df7aab22ca1fe2145f2d2a89abd2d58825ec92
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 28d4b97..fff84ba 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
@@ -1031,31 +1032,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
- branch wip-emacs-popup-ui created (now 2392984), Alex Kost, 2015/08/18
- 01/20: guix lint: Export checkers and <lint-checker> accessors., Alex Kost, 2015/08/18
- 03/20: emacs: Add 'guix-package-names'., Alex Kost, 2015/08/18
- 05/20: emacs: Add and use 'guix-concat-strings'., Alex Kost, 2015/08/18
- 04/20: emacs: Add and use 'guix-while-search'., Alex Kost, 2015/08/18
- 06/20: emacs: Add utils to make symbol and string for guix command., Alex Kost, 2015/08/18
- 08/20: emacs: Add 'guix-any'., Alex Kost, 2015/08/18
- 09/20: emacs: Add 'guix-memoized-defalias' macro., Alex Kost, 2015/08/18
- 13/20: ui: Add 'run-guix'.,
Alex Kost <=
- 02/20: emacs: Add 'guix-lint-checker-names'., Alex Kost, 2015/08/18
- 14/20: emacs: Add code to run guix command in REPL., Alex Kost, 2015/08/18
- 10/20: emacs: Add help variables., Alex Kost, 2015/08/18
- 07/20: emacs: Add utils to copy guix command., Alex Kost, 2015/08/18
- 15/20: emacs: Add code to run guix command in shell., Alex Kost, 2015/08/18
- 20/20: emacs: Use popup interface instead 'guix-pull' command., Alex Kost, 2015/08/18
- 11/20: emacs: Add minibuffer readers., Alex Kost, 2015/08/18
- 16/20: doc: Reorganize "Emacs Interface" node., Alex Kost, 2015/08/18
- 17/20: emacs: Add "guix-popup.el"., Alex Kost, 2015/08/18
- 12/20: emacs: Add and use alist accessors., Alex Kost, 2015/08/18