local a=import("component")local b=import("computer")local c={...}if not c then return print("\x1b[91mCannot get arguments.")end;if not c[1]then return shell.run("help label")end;local d=c[1]local e;local function f(b)if b>=5 and b<=8 then b=b-1 end;for c,d in a.list()do if a.slot(c)==b then e=a.proxy(c)end end end;if d=="eeprom"then e=a.eeprom elseif d=="halyde"then e=a.proxy(b.getBootAddress())elseif d:sub(1,4)=="slot"and tonumber(d:sub(5))then local a=tonumber(d:sub(5))-1;f(a)elseif d:sub(1,1)=="#"and tonumber(d:sub(2))then local a=tonumber(d:sub(2))+5;f(a)elseif#d>=3 then local b=a.get(d)if not b then return print("\x1b[91mCould not find entire component ID from \""..d.."\".")end;e=a.proxy(b)else print("\x1b[91mAddress must have atleast 3 characters")return shell.run("help label")end;if not e then return print("\x1b[91mCould not find component from \""..d.."\".")end;local a=e.address;local function b(a)return a:sub(1,8).."\x1b[37m"..a:sub(9).."\x1b[39m"end;local function d(c)print("This \x1b[92m"..(e.type or"unknown").."\x1b[39m component doesn't support "..c.." labels.\nID: "..b(a))end;local function f(b,c)print("\x1b[91mAn error occured while "..b.." the label of this component.\nComponent: "..(a or"unknown id").." ("..((e or{}).type or"unknown type")..")\n\n"..c)end;local function g(a)local b="No label defined"if a then b="\""..a.."\""end;return b end;if type(c[2])~="string"then if not e.getLabel then return d("getting")end;local c;local d,h=pcall(function()c=e.getLabel()end)if d then print("Label of "..b(a)..((e.type and e.type~="filesystem")and" ("..e.type..")"or"")..":\n \x1b[92m"..g(c).."\x1b[39m")else f("getting",h)end else if not e.setLabel then return d("setting")end;local d=""for a=2,#c do d=d..tostring(c[a])if a<#c then d=d.." "end end;local c;local d,h=pcall(function()c=e.setLabel(d)end)if d then print("Successfully set label of "..b(a)..(e.type and" ("..e.type..")"or"").." to:\n \x1b[92m"..g(c).."\x1b[39m")else f("setting",h)end end