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.
master
Alex Kost 2015-08-16 10:28:04 +03:00
parent 51dac38339
commit caa6732e96
1 changed files with 29 additions and 22 deletions

View File

@ -2,7 +2,7 @@
;;; Copyright © 2012, 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2013 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
;;; Copyright © 2014 Alex Kost <alezost@gmail.com>
;;; Copyright © 2014, 2015 Alex Kost <alezost@gmail.com>
;;; Copyright © 2014 Deck Pickard <deck.r.pickard@gmail.com>
;;;
;;; 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,13 +1033,12 @@ found."
(parameterize ((program-name command))
(apply command-main args))))
(define guix-warning-port
(make-parameter (current-warning-port)))
(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? "-" <>))
(define (guix-main arg0 . args)
(initialize-guix)
(let ()
(define (option? str) (string-prefix? "-" str))
(match args
(()
(format (current-error-port)
@ -1057,6 +1057,13 @@ found."
((command args ...)
(apply run-guix-command
(string->symbol command)
args)))))
args))))
(define guix-warning-port
(make-parameter (current-warning-port)))
(define (guix-main arg0 . args)
(initialize-guix)
(apply run-guix args))
;;; ui.scm ends here