refactor parallel code
This commit is contained in:
17
openos/hostname.lua
Normal file
17
openos/hostname.lua
Normal file
@@ -0,0 +1,17 @@
|
||||
local os = _G.os
|
||||
|
||||
local shell = require("openos.shell")
|
||||
local args = shell.parse(...)
|
||||
local hostname = args[1]
|
||||
|
||||
if hostname then
|
||||
os.setComputerLabel(hostname)
|
||||
else
|
||||
hostname = os.getComputerLabel()
|
||||
if hostname then
|
||||
print(hostname)
|
||||
else
|
||||
io.stderr:write("Hostname not set\n")
|
||||
return 1
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user