-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bbs.ps1
59 lines (50 loc) · 1022 Bytes
/
bbs.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
function Get-EmojiFile() {
return [System.Char]::ConvertFromUtf32(0x1F4C4)
}
function Get-EmojiOpenFolder() {
return [System.Char]::ConvertFromUtf32(0x1F4C2)
}
function Get-Icon($item) {
if ($_.PSIsContainer) {
return Get-EmojiOpenFolder
} else {
return Get-EmojiFile
}
}
#
# Functions beginning with an underscore (_) are prototypes that
# are under development and will be renamed to conventional form.
#
function _CLS {
Clear-Host
}
function _DIR($criteria) {
Get-ChildItem | ForEach-Object {
if ($_.Name -like "$criteria*") {
Write-Host "$(Get-Icon($_)) $_"
}
}
}
function _EXEC($command) {
_DIR $command
}
function _READ {
return Read-Host ":"
}
Write-Host "hello world"
_DIR
$exit = $false
do {
$userInput = _READ
switch ($userInput) {
"cls" {
_CLS
}
"exit" {
$exit = $true
}
default {
_EXEC $userInput
}
}
} while (-not $exit)