Properly fix the 'cd $HOME' issue
[git/jnareb-git.git] / share / msysGit / add-shortcut.tcl
blob5e5247c4bc978289324443cabaec177f214c2c86
1 #!/mingw/bin/tclsh
3 switch -regexp [lindex $argv 0] {
4 "^(|help|-h|-help|--help)$" {
5 puts "Usage: $argv0 \[option\]"
6 puts "Options:"
7 puts ""
8 puts " QuickLaunch create a QuickLaunch icon"
9 puts " Desktop create an icon on the Desktop"
10 puts " StartMenu create an icon in your start menu"
11 puts " StartMenu2 create an icon in start menu's Programs>msysGit"
12 puts " AllUsersStartMenu create an icon in All Users' start menu"
13 puts " AllUsersStartMenu2 create an icon in All Users'"
14 puts " start menu's Programs>msysGit"
15 puts " EnableQuickEdit enable the QuickEdit mode in the console"
16 puts ""
17 puts "Short options are q, d, s, s2, a and a2."
18 exit 1
20 "^(quicklaunch|QuickLaunch|q)$" {
21 set targetDirectory \
22 "$env(APPDATA)/Microsoft/Internet Explorer/Quick Launch"
24 "^(Desktop|desktop|d)$" {
25 set targetDirectory "$env(USERPROFILE)/Desktop"
27 "^(StartMenu|startmenu|start|s)$" {
28 package require registry 1.0
29 set key "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows"
30 set key "$key\\CurrentVersion\\Explorer\\Shell Folders"
31 set targetDirectory [registry get $key "Start Menu"]
33 "^(StartMenu2|startmenu2|start2|s2)$" {
34 set startMenuName "msysGit"
35 package require registry 1.0
36 set key "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows"
37 set key "$key\\CurrentVersion\\Explorer\\Shell Folders"
38 set programs [registry get $key "Programs"]
39 file mkdir $programs/$startMenuName
40 set targetDirectory $programs/$startMenuName
42 "^(AllUsersStartMenu|allusersstartmenu|allusers|a)$" {
43 package require registry 1.0
44 set key "HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows"
45 set key "$key\\CurrentVersion\\Explorer\\Shell Folders"
46 set targetDirectory [registry get $key "Common Start Menu"]
48 "^(AllUsersStartMenu2|allusersstartmenu2|allusers2|a2)$" {
49 set startMenuName "msysGit"
50 package require registry 1.0
51 set key "HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows"
52 set key "$key\\CurrentVersion\\Explorer\\Shell Folders"
53 set programs [registry get $key "Common Programs"]
54 file mkdir $programs/$startMenuName
55 set targetDirectory $programs/$startMenuName
57 "^(EnableQuickEdit|quickedit)$" {
58 package require registry 1.0
59 regsub "^(.*)/etc/inputrc" $env(INPUTRC) "\\1" msysRoot
60 set sh [string map { "\\" "_" "/" "_" } $msysRoot/bin/sh.exe]
61 set key "HKEY_CURRENT_USER\\Console"
62 registry set $key "QuickEdit" 1 dword
63 registry set $key "HistoryBufferSize" 999 dword
64 registry broadcast $key
65 registry broadcast "Console"
66 exit 0
68 default {
69 puts "Unknown argument: [lindex $argv 0]"
70 exit 1
74 cd [file dirname $argv0]
76 regsub "^(.*)/etc/inputrc" $env(INPUTRC) "\\1" msysRoot
77 exec make
79 set binDirectory "$msysRoot/bin"
80 set resDirectory "$msysRoot/share/resources"
82 exec ./create-shortcut.exe --work-dir "%HOMEDRIVE%%HOMEPATH%" \
83 --icon-file "$resDirectory/msysgitlogo.ico" \
84 --arguments "--login -i" \
85 "$binDirectory/sh.exe" \
86 "$targetDirectory/msysGit.lnk"