aboutsummaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fl.fischer@fau.de>2019-10-30 19:55:09 +0100
committerFlorian Fischer <florian.fl.fischer@fau.de>2019-10-30 19:55:09 +0100
commitdcfacfee3fa77a292587754be02dd7c8f034f885 (patch)
tree81b7bf9b30449b169022dd3a260087c643ae4f71 /config
parent3970c1f7d24c84c176c7f12b194003200b57fc32 (diff)
downloaddotfiles-dcfacfee3fa77a292587754be02dd7c8f034f885.tar.gz
dotfiles-dcfacfee3fa77a292587754be02dd7c8f034f885.zip
[xonsh] import aliases from the generic alias file
Diffstat (limited to 'config')
-rw-r--r--config/xonsh/rc.xsh31
1 files changed, 12 insertions, 19 deletions
diff --git a/config/xonsh/rc.xsh b/config/xonsh/rc.xsh
index b05fe58..18138dc 100644
--- a/config/xonsh/rc.xsh
+++ b/config/xonsh/rc.xsh
@@ -1,23 +1,16 @@
### ALIASES ###
-aliases["ll"] = "ls -l -h"
-aliases["la"] = "ll -a"
-
-# git
-aliases["ga"] = "git add"
-aliases["gca"] = "git commit -v -a"
-aliases["gcm"] = "git commit -m"
-aliases["gl"] = "git pull"
-aliases["glg"] = "git log --stat --color"
-aliases["gp"] = "git push"
-aliases["gst"] = "git status"
-
-def pss(args, stdin=None, stdout=None, stderr=None):
- if len(args) != 1:
- print("Usage: pss PATTERN", file=stderr)
- pids = $(pgrep -d , -f @(args[0]))[:-1]
- if pids:
- $[ps -Fp @(pids)]
-aliases["pss"] = pss
+
+# import shell aliases
+import re
+alias_file = p'$DOTFILES_LOCATION/aliases'
+with alias_file.open('r') as af:
+ common_aliases = af.read()
+
+for line in common_aliases.splitlines():
+ if line.startswith('alias '):
+ match = re.match(r'^alias ([\w-]*)=[\'\"](.*?)[\"\']$', line)
+ if match:
+ aliases[match.group(1)] = match.group(2)
def fd(args, stdin=None, stdout=None, stderr=None):
if len(args) != 1: