-
Notifications
You must be signed in to change notification settings - Fork 35
/
.nyagos
42 lines (37 loc) · 1.25 KB
/
.nyagos
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
-- This is a sample .nyagos written with Lua.
-- Edit and put it on %USERPROFILE%, %HOME% or the same folder with nyagos.exe
-- Simple Prompt for CMD.EXE
do
local hostname = nyagos.env.COMPUTERNAME
if not hostname then
local fd = io.open("/etc/hostname")
if fd then
hostname = fd:read("*l")
fd:close()
end
end
nyagos.env.PROMPT='$L'.. (hostname or "").. ':$P$G$_$$$s'
end
-- Coloring Prompt for NYAGOS.exe
-- Sample 1: simple prompt string
-- nyagos.prompt = '$e[40;31;1m'.. nyagos.env.prompt ..'$e[37;1m'
-- Sample 2: function
nyagos.prompt = function(this)
local wd = nyagos.getwd()
local env = nyagos.env
local home = env.HOME or env.USERPROFILE
local home_len = home:len()
if wd:sub(1,home_len) == home then
wd = "~" .. wd:sub(home_len+1)
end
local title = wd .. " - NYAGOS"
local no_color = nyagos.env.NO_COLOR
if no_color and no_color ~= '' then
return nyagos.default_prompt(this,title)
elseif nyagos.elevated() then
return nyagos.default_prompt('$e[49;31;1m'..this..'$e[37;1m',title)
else
return nyagos.default_prompt('$e[49;36;1m'..this..'$e[37;1m',title)
end
end
-- vim:set ft=lua: --