Skip to content

Commit 0c70163

Browse files
committed
implement filter plugin: shell_config
1 parent 366ab20 commit 0c70163

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

filter_plugins/shell_config.py

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
"""
2+
各シェルの設定ファイルを返す。
3+
/bin/bashなら ['bash', '.bashrc', '.bash_profile']、など。
4+
"""
5+
6+
from __future__ import (absolute_import, division, print_function)
7+
__metaclass__ = type
8+
9+
10+
def get_shell_config(shell_path):
11+
shell_name = shell_path.split('/')[-1]
12+
if shell_name == 'bash':
13+
return {
14+
'name': 'bash',
15+
'rc_file': '.bashrc',
16+
'profile_path': '.bash_profile'
17+
}
18+
elif shell_name == 'zsh':
19+
return {
20+
'name': 'zsh',
21+
'rc_file': '.zshrc',
22+
'profile_path': '.zprofile'
23+
}
24+
# 他のシェルに対する設定をここに追加
25+
else:
26+
return {
27+
'name': shell_name,
28+
'rc_file': None,
29+
'profile_path': None
30+
}
31+
32+
33+
class FilterModule(object):
34+
def filters(self):
35+
return {
36+
'shell_config': get_shell_config
37+
}

0 commit comments

Comments
 (0)