-
Notifications
You must be signed in to change notification settings - Fork 0
/
.xonshrc
47 lines (34 loc) · 1.22 KB
/
.xonshrc
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
$PROMPT = '╭─{BOLD_GREEN}{user}@{hostname} {BOLD_#3498db}{cwd} {branch_color}{curr_branch: {}}{NO_COLOR} {WHITE} \n╰─λ '
def _find_files(args, stdin=None):
if len(args) is 0:
echo "Please input file names you want to search in current folder."
echo "For example: 'find bar' "
return
if args[0] == "--help":
echo "ff: Find files"
echo "For example: 'find bar'"
return
if $(type fd):
fd @(args[0])
return
search_expr = "*{}*".format(args[0])
find . -iname @(search_expr) -type f -print
aliases['ff'] = _find_files
def _find_lines_contains_string_in_current_folder_recursively(args, stdin=None):
if len(args) is 0:
echo "Please input the keyword you want to search in current folder."
echo "For example: 'find bar' "
return
if $(type rg):
rg @(args[0])
return
find . -name "*" -type f | xargs grep @(args[0]) --line-number
aliases['fl'] = _find_lines_contains_string_in_current_folder_recursively
def _today():
from os.path import isdir
get_today = $(date '+%Y%m%d')
today = get_today.rstrip()
if not isdir(today):
mkdir @(today)
cd @(today)
aliases['today'] = _today