summaryrefslogtreecommitdiff
path: root/guix
diff options
context:
space:
mode:
Diffstat (limited to 'guix')
-rw-r--r--guix/scripts/home/import.scm15
1 files changed, 9 insertions, 6 deletions
diff --git a/guix/scripts/home/import.scm b/guix/scripts/home/import.scm
index 15bd3140ed..f01a98bc55 100644
--- a/guix/scripts/home/import.scm
+++ b/guix/scripts/home/import.scm
@@ -1,7 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
;;; Copyright © 2021 Andrew Tropin <andrew@trop.in>
-;;; Copyright © 2021 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2021-2022 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2022 Arjan Adriaanse <arjan@adriaan.se>
;;;
;;; This file is part of GNU Guix.
@@ -60,12 +60,15 @@ FILE-NAME with \"-\", and return the basename of it."
(define (destination-append path)
(string-append destination-directory "/" path))
+ (define alias-rx
+ (make-regexp "^alias ([^=]+)=[\"'](.+)[\"']$"))
+
(define (bash-alias->pair line)
- (if (string-prefix? "alias" line)
- (let ((matched (string-match "alias (.+)=\"?'?([^\"']+)\"?'?" line)))
- `(,(match:substring matched 1) . ,(match:substring matched 2)))
- '()))
-
+ (match (regexp-exec alias-rx line)
+ (#f '())
+ (matched
+ `(,(match:substring matched 1) . ,(match:substring matched 2)))))
+
(define (parse-aliases input)
(let loop ((line (read-line input))
(result '()))