-
Notifications
You must be signed in to change notification settings - Fork 0
/
profile.ps1
112 lines (90 loc) · 3.04 KB
/
profile.ps1
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# ===========================================================================
# Profile.ps1 -------------------------------------------------------------
# ===========================================================================
# import ------------------------------------------------------------------
# ---------------------------------------------------------------------------
if (Get-Module -ListAvailable | Where-Object {$_.Name -eq "SciProfile"}){
# import main module
Import-Module SciProfile
# import user defined module
Write-Host
Import-PSMModule
# import user defined functions
Import-PSMFunction
# activate autocompletion
. (activate-sci)
}
# settings ----------------------------------------------------------------
# ---------------------------------------------------------------------------
Set-PSReadlineKeyHandler -Chord Alt+F4 -Function ViExit # 'alt+F' or 'alt+space c'
Set-PSReadlineKeyHandler -Key Tab -Function Complete
Set-PSReadlineKeyHandler -Key UpArrow -Function HistorySearchBackward
Set-PSReadlineKeyHandler -Key DownArrow -Function HistorySearchForward
Set-PSReadlineOption -BellStyle None
function Open-History {
# Get-Content (Get-PSReadlineOption).HistorySavePath
$file_path = (Get-PSReadlineOption).HistorySavePath
code -n $file_path
}
function Start-DEMShell{
Param (
[Parameter(Position = 0, Mandatory = $True)]
[ValidateSet('default', 'all', 'dqp-db', 'gsp-db', 'dem-db', 'db', 'dqp', 'gsp', 'rs-gsp', 'rs-dem', 'rs-dqp')]
[string] $server,
[ValidateSet('localhost', 'system')]
[string] $ip,
[switch] $local
)
if ($server -ne "default") {
$cmd = "Start-DEMServer -server $server"
}
if ($ip) { $cmd += " -ip $ip"}
if ($local) { $cmd += " -local" }
Start-Process pwsh -ArgumentList @("-noexit -command
cd $env:DEM_HOME;
. .\init.ps1;
`"$cmd`";
")
}
function Start-DEMShellServer {
Start-DEMShell -all
}
function Start-DEMDevelopment {
Start-DEMShell -server dem-db
Start-DEMShell -server rs-gsp -ip system -local
Start-Sleep -Seconds 5
Start-DEMShell -server gsp
Start-Process code -ArgumentList $env:DEM_HOME
}
$DEM_GIT_INTERNSHIP = @("feature/students", "feature/data-preparation", "feature/visualization", "feature/patch-generation")
$DEM_GIT_ALL = @("main", "dev", "feature/students", "feature/data-preparation", "feature/visualization", "feature/patch-generation")
$DEM_GIT_MAIN = @("main", "dev", "prototyp/dem_beta")
function Invoke-GitDEMPush {
Param(
[Parameter(Mandatory=$True)]
$branch,
[Parameter(Mandatory = $True)]
[system.string[]] $branches
)
$branches | ForEach-Object {
git checkout $_
git merge $branch
git pull origin $_
git push origin $_
}
git checkout $branch
}
function Invoke-GitDEMPull {
Param(
[Parameter(Mandatory = $True)]
$branch,
[Parameter(Mandatory = $True)]
[system.string[]] $branches
)
$branches | ForEach-Object {
git checkout $_
git pull origin $_
}
git checkout $branch
}
function ipy { python .\run.py }