-
Notifications
You must be signed in to change notification settings - Fork 7
/
gitvall
executable file
·73 lines (69 loc) · 1.74 KB
/
gitvall
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/env lua
local gitvPath
local isWin=string.find(string.lower(os.getenv('OS') or 'nil'),'windows')~=nil
if isWin then
gitvPath=os.getenv('HOMEDRIVE')..os.getenv('HOMEPATH').."/bin"
else
gitvPath=os.getenv('HOME').."/bin"
end
package.path = package.path .. ";"..gitvPath.."/?.lua"
dofile(gitvPath.."/gitv")
g_gitPaths={"~/taesooLib", "~/Documents/papers", "~/taesoo_cmu", "~/taesoo"}
if os.isFileExist(os.home_path()..'/.gitvconfig') then
dofile(os.home_path()..'/.gitvconfig')
end
lsFiles_single=lsFiles
function lsFiles(option)
local files={}
for i,v in ipairs(g_gitPaths) do
cache_git_top=v
local out=lsFiles_single('-g')
array.concat(files,out)
end
for i,v in ipairs(files) do
local t=string.gsub(v,'~', os.home_path())
files[i]=os.absoluteToRelativePath(t)
end
table.sort(files, git_tools.compareFileName)
return files
end
lsFolders_single=lsFolders
function lsFolders(option)
local folders={}
for i,v in ipairs(g_gitPaths) do
cache_git_top=v
local out=lsFolders_single('-g', lsFiles_single)
array.concat(folders,out)
end
for i,v in ipairs(folders) do
local t=string.gsub(v,'~', os.home_path())
folders[i]=os.absoluteToRelativePath(t)
if folders[i] =='' then
folders[i]='../'..os.filename(os.relativeToAbsolutePath(folders[i]))
end
end
table.sort(folders, git_tools.compareFileName)
return folders
end
if arg[1] then
if arg[1]=='pull' or
arg[1]=='push' or
arg[1]=='sync' or
arg[1]=='fetch' then
for i,v in ipairs(g_gitPaths) do
local t=string.gsub(v,'~', os.home_path())
cache_git_top=t
print('\n> cd "'..v..'"')
main(unpack(arg))
end
elseif arg[1]=='diff' or
arg[1]=='ci' or
arg[1]=='cif' or
arg[1]=='ts' then
main('all', unpack(arg))
else
main(unpack(arg))
end
else
printHelp()
end