From 805f20b339034974ed3f47a4e5fb4a58f5ee58ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Pinson?= 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