aboutsummaryrefslogtreecommitdiffstats
path: root/main/augeas/0010-Shellvars-add-alias-builtin-support.patch
blob: 70b2f8b2ee5b0deddbea63bceae4942dcb77aa21 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
From 805f20b339034974ed3f47a4e5fb4a58f5ee58ad Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rapha=C3=ABl=20Pinson?= <raphael.pinson@camptocamp.com>
Date: Thu, 30 Jul 2015 09:22:22 +0200
Subject: [PATCH 10/19] Shellvars: add alias builtin support

---
 lenses/shellvars.aug            | 7 +++++++
 lenses/tests/test_shellvars.aug | 4 ++++
 2 files changed, 11 insertions(+)

diff --git a/lenses/shellvars.aug b/lenses/shellvars.aug
index 8735d77..f681fcd 100644
--- a/lenses/shellvars.aug
+++ b/lenses/shellvars.aug
@@ -87,6 +87,11 @@ module Shellvars =
     Util.indent . Util.del_str "eval" . Util.del_ws_spc
     . label "@eval" . store anyquot
 
+  let alias =
+    Util.indent . Util.del_str "alias" . Util.del_ws_spc
+    . label "@alias" . store key_re . eq
+    . [ label "value" . store anyquot ]
+
   let builtin =
     Util.indent . label "@builtin"
     . store shell_builtin_cmds
@@ -174,6 +179,7 @@ module Shellvars =
         | entry_eol_item return
         | entry_eol_item condition
         | entry_eol_item eval
+        | entry_eol_item alias
 
   let entry_noeol =
     let entry_item (item:lens) = [ item ] in
@@ -185,6 +191,7 @@ module Shellvars =
         | entry_item return
         | entry_item condition
         | entry_item eval
+        | entry_item alias
 
   let rec rec_entry =
     let entry = comment | entry_eol | rec_entry in
diff --git a/lenses/tests/test_shellvars.aug b/lenses/tests/test_shellvars.aug
index 9d301af..26aec25 100644
--- a/lenses/tests/test_shellvars.aug
+++ b/lenses/tests/test_shellvars.aug
@@ -584,6 +584,10 @@ esac\n" =
   test lns get "eval `dircolors`\n" =
     { "@eval" = "`dircolors`" }
 
+  (* alias *)
+  test lns get "alias ls='ls $LS_OPTIONS'\n" =
+    { "@alias" = "ls" { "value" = "'ls $LS_OPTIONS'" } }
+
 (* Local Variables: *)
 (* mode: caml       *)
 (* End:             *)
-- 
2.5.0