From 3441e164976c14ef8bf9a95ab4130ca25ac85e70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sat, 5 Jan 2013 15:55:47 +0100 Subject: [PATCH] ui: Factorize bug-report information in `--help'. * guix/config.scm.in (%guix-home-page-url): New variable. * guix/ui.scm (show-bug-report-information): New procedure. * guix-build.in (show-help): Use it. * guix-download.in (show-help): Likewise. * guix-import.in (show-help): Likewise. * guix-package.in (show-help): Likewise. --- guix-build.in | 5 ++--- guix-download.in | 5 ++--- guix-import.in | 5 ++--- guix-package.in | 5 ++--- guix/config.scm.in | 6 +++++- guix/ui.scm | 12 +++++++++++- po/POTFILES.in | 1 + 7 files changed, 25 insertions(+), 14 deletions(-) diff --git a/guix-build.in b/guix-build.in index 5136a2a5e4..96ec018a51 100644 --- a/guix-build.in +++ b/guix-build.in @@ -12,7 +12,7 @@ exec ${GUILE-@GUILE@} -L "@guilemoduledir@" -l "$0" \ -c "(apply $main (cdr (command-line)))" "$@" !# ;;; Guix --- Nix package management from Guile. -*- coding: utf-8 -*- -;;; Copyright (C) 2012 Ludovic Courtès +;;; Copyright (C) 2012, 2013 Ludovic Courtès ;;; ;;; This file is part of Guix. ;;; @@ -104,8 +104,7 @@ Build the given PACKAGE-OR-DERIVATION and return their output paths.\n")) (display (_ " -V, --version display version information and exit")) (newline) - (format #t (_ " -Report bugs to: ~a.~%") "@PACKAGE_BUGREPORT@")) + (show-bug-report-information)) (define %options ;; Specifications of the command-line options. diff --git a/guix-download.in b/guix-download.in index f76396b97c..50ad26a773 100644 --- a/guix-download.in +++ b/guix-download.in @@ -12,7 +12,7 @@ exec ${GUILE-@GUILE@} -L "@guilemoduledir@" -l "$0" \ -c "(apply $main (cdr (command-line)))" "$@" !# ;;; Guix --- Nix package management from Guile. -;;; Copyright (C) 2012 Ludovic Courtès +;;; Copyright (C) 2012, 2013 Ludovic Courtès ;;; ;;; This file is part of Guix. ;;; @@ -90,8 +90,7 @@ and the hash of its contents.\n")) (display (_ " -V, --version display version information and exit")) (newline) - (format #t (_ " -Report bugs to: ~a.~%") "@PACKAGE_BUGREPORT@")) + (show-bug-report-information)) (define %options ;; Specifications of the command-line options. diff --git a/guix-import.in b/guix-import.in index 5dc93708b4..e0441f4dc7 100644 --- a/guix-import.in +++ b/guix-import.in @@ -12,7 +12,7 @@ exec ${GUILE-@GUILE@} -L "@guilemoduledir@" -l "$0" \ -c "(apply $main (cdr (command-line)))" "$@" !# ;;; Guix --- Nix package management from Guile. -*- coding: utf-8 -*- -;;; Copyright (C) 2012 Ludovic Courtès +;;; Copyright (C) 2012, 2013 Ludovic Courtès ;;; ;;; This file is part of Guix. ;;; @@ -88,8 +88,7 @@ Import and convert the Nix expression ATTRIBUTE of NIXPKGS.\n")) (display (_ " -V, --version display version information and exit")) (newline) - (format #t (_ " -Report bugs to: ~a.~%") "@PACKAGE_BUGREPORT@")) + (show-bug-report-information)) (define %options ;; Specification of the command-line options. diff --git a/guix-package.in b/guix-package.in index fee1a39b2f..cd276006c7 100644 --- a/guix-package.in +++ b/guix-package.in @@ -12,7 +12,7 @@ exec ${GUILE-@GUILE@} -L "@guilemoduledir@" -l "$0" \ -c "(apply $main (cdr (command-line)))" "$@" !# ;;; Guix --- Nix package management from Guile. -*- coding: utf-8 -*- -;;; Copyright (C) 2012 Ludovic Courtès +;;; Copyright (C) 2012, 2013 Ludovic Courtès ;;; ;;; This file is part of Guix. ;;; @@ -217,8 +217,7 @@ Install, remove, or upgrade PACKAGES in a single transaction.\n")) (display (_ " -V, --version display version information and exit")) (newline) - (format #t (_ " -Report bugs to: ~a.~%") "@PACKAGE_BUGREPORT@")) + (show-bug-report-information)) (define %options ;; Specification of the command-line options. diff --git a/guix/config.scm.in b/guix/config.scm.in index c5ebd39fae..321323c003 100644 --- a/guix/config.scm.in +++ b/guix/config.scm.in @@ -1,5 +1,5 @@ ;;; Guix --- Nix package management from Guile. -*- coding: utf-8 -*- -;;; Copyright (C) 2012 Ludovic Courtès +;;; Copyright (C) 2012, 2013 Ludovic Courtès ;;; ;;; This file is part of Guix. ;;; @@ -20,6 +20,7 @@ (define-module (guix config) #:export (%guix-package-name %guix-version %guix-bug-report-address + %guix-home-page-url %store-directory %state-directory %system @@ -42,6 +43,9 @@ (define %guix-version (define %guix-bug-report-address "@PACKAGE_BUGREPORT@") +(define %guix-home-page-url + "@PACKAGE_URL@") + (define %store-directory "@storedir@") diff --git a/guix/ui.scm b/guix/ui.scm index 4fc0dd089a..6c148797ee 100644 --- a/guix/ui.scm +++ b/guix/ui.scm @@ -1,5 +1,5 @@ ;;; Guix --- Nix package management from Guile. -*- coding: utf-8 -*- -;;; Copyright (C) 2012 Ludovic Courtès +;;; Copyright (C) 2012, 2013 Ludovic Courtès ;;; ;;; This file is part of Guix. ;;; @@ -28,6 +28,7 @@ (define-module (guix ui) N_ leave show-version-and-exit + show-bug-report-information call-with-error-handling with-error-handling location->string)) @@ -56,6 +57,15 @@ (define* (show-version-and-exit #:optional (command (car (command-line)))) command %guix-package-name %guix-version) (exit 0)) +(define (show-bug-report-information) + (format #t (_ " +Report bugs to: ~a.") %guix-bug-report-address) + (format #t (_ " +~a home page: <~a>") %guix-package-name %guix-home-page-url) + (display (_ " +General help using GNU software: ")) + (newline)) + (define (call-with-error-handling thunk) "Call THUNK within a user-friendly error handler." (guard (c ((package-input-error? c) diff --git a/po/POTFILES.in b/po/POTFILES.in index fcc84f32f0..fbcd957a16 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -7,3 +7,4 @@ distro/packages/recutils.scm guix/ui.scm guix-build.in guix-download.in +guix-package.in