Skip to content

Instantly share code, notes, and snippets.

@tomodachi94
Last active December 6, 2022 00:21
Show Gist options
  • Save tomodachi94/57b52cef2ad117c0b4130429dc80964a to your computer and use it in GitHub Desktop.
Save tomodachi94/57b52cef2ad117c0b4130429dc80964a to your computer and use it in GitHub Desktop.
Bootstrap Unix-like directories onto a ComputerCraft computer's path
local shell = shell
if _HOST:find("Recrafted") then
shell = require("shell")
end
shell.run("/bin/unix-path-bootstrap.lua")
local shell = shell
local help = help
if _HOST:find("Recrafted") then
shell = require("shell")
help = require("help")
end
shell.setPath(shell.path()..":/bin")
help.setPath(help.path()..":/usr/share/help")
@Commandcracker
Copy link

@tomodachi94 add this for basic auto-completion

local completion = require "cc.shell.completion"

shell.setCompletionFunction("bin/unicorntool.lua", completion.build({ completion.choice, { "install", "uninstall", "add", "remove" } }))
shell.setCompletionFunction("bin/hoof.lua", completion.build({ completion.choice, { "install", "uninstall", "add", "remove" } }))

@tomodachi94
Copy link
Author

tomodachi94 commented Dec 6, 2022

Fancy! Thank you @Commandcracker!

Edit: I've added these to unicornpkg/cli.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment