]>
Softwares of Agnibho - ddstorm.git/blob - alias.py
5 # Copyright (c) 2015 Agnibho Mondal
8 # This file is part of DDStorm.
10 # DDStorm is free software: you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation, either version 3 of the License, or
13 # (at your option) any later version.
15 # DDStorm is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with DDStorm. If not, see <http://www.gnu.org/licenses/>.
24 from fnmatch
import fnmatch
29 def __init__(self
, conf
=False):
38 for path
, subdirs
, files
in os
.walk(self
.conf
.get("alias_path")):
40 if(fnmatch(name
, "*.txt")):
41 with
open(self
.conf
.get("alias_path")+name
, "r") as f
:
43 line
=line
.rstrip().split("#")[0]
48 for i
in line
.split(";"):
50 terms
.append(i
.strip())
52 self
.data
[terms
[-1]]=terms
[0]
59 if(term
in self
.data
):
60 return self
.data
[term
]
67 print(a
.get(sys
.argv
[1]))
69 if(__name__
=="__main__"):