[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
17/23: ui: Add 'run-guix'.
From: |
Alex Kost |
Subject: |
17/23: ui: Add 'run-guix'. |
Date: |
Sun, 30 Aug 2015 15:28:15 +0000 |
alezost pushed a commit to branch master
in repository guix.
commit caa6732e967ef4e397533d1cff9ba5626b2b4131
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 | 51 +++++++++++++++++++++++++++++----------------------
1 files changed, 29 insertions(+), 22 deletions(-)
diff --git a/guix/ui.scm b/guix/ui.scm
index a6d4fd1..8de8e3c 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,37 @@ found."
(parameterize ((program-name command))
(apply command-main args))))
+(define (run-guix . args)
+ "Run the 'guix' command defined by command line ARGS.
+Unlike 'guix-main', this procedure assumes that locale, i18n support,
+and signal handling has already been set up."
+ (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
- 02/23: emacs: Add 'guix-prettify' to 'guix' custom group., (continued)
- 02/23: emacs: Add 'guix-prettify' to 'guix' custom group., Alex Kost, 2015/08/30
- 01/23: emacs: Remove leftover internal variable., Alex Kost, 2015/08/30
- 03/23: emacs: Add and use 'guix-while-search'., Alex Kost, 2015/08/30
- 04/23: emacs: Add and use 'guix-concat-strings'., Alex Kost, 2015/08/30
- 05/23: emacs: Add utils to make symbol and string for guix command., Alex Kost, 2015/08/30
- 09/23: guix lint: Export checkers and <lint-checker> accessors., Alex Kost, 2015/08/30
- 06/23: emacs: Add utils to copy guix command., Alex Kost, 2015/08/30
- 08/23: emacs: Add 'guix-memoized-defalias' macro., Alex Kost, 2015/08/30
- 07/23: emacs: Add 'guix-any'., Alex Kost, 2015/08/30
- 10/23: emacs: Add 'guix-lint-checker-names'., Alex Kost, 2015/08/30
- 17/23: ui: Add 'run-guix'.,
Alex Kost <=
- 11/23: guix graph: Export node types and <node-type> accessors., Alex Kost, 2015/08/30
- 12/23: emacs: Add 'guix-graph-type-names'., Alex Kost, 2015/08/30
- 18/23: emacs: Add code to run guix command in REPL., Alex Kost, 2015/08/30
- 15/23: emacs: Add minibuffer readers., Alex Kost, 2015/08/30
- 19/23: emacs: Add code to run guix command in shell., Alex Kost, 2015/08/30
- 13/23: emacs: Add 'guix-package-names'., Alex Kost, 2015/08/30
- 14/23: emacs: Add help variables., Alex Kost, 2015/08/30
- 21/23: emacs: Add "guix-popup.el"., Alex Kost, 2015/08/30
- 20/23: doc: Reorganize "Emacs Interface" node., Alex Kost, 2015/08/30
- 23/23: emacs: Use prompt for packages instead popup for edit action., Alex Kost, 2015/08/30