ComputerCraft Archive

gitfs

computer utility kepler155c github

Description

ComputerCraft OS

Installation

Copy one of these commands into your ComputerCraft terminal:

wget:wget https://raw.githubusercontent.com/kepler155c/opus/develop-1.8/sys/modules/opus/fs/gitfs.lua gitfs
Archive:wget https://cc.shobie.xyz/cc/get/gh-kepler155c-opus-sys-modules-opus-fs-gitfs gitfs
Quick Install: wget https://cc.shobie.xyz/cc/get/gh-kepler155c-opus-sys-modules-opus-fs-gitfs gitfs

Usage

Run: gitfs

Tags

none

Source

View Original Source

Code Preview

local git = require('opus.git')

local fs = _G.fs

local gitfs = { }

function gitfs.mount(dir, repo)
	if not repo then
		error('gitfs syntax: repo')
	end

	local list = git.list(repo)
	for path, entry in pairs(list) do
		if not fs.exists(fs.combine(dir, path)) then
			local node = fs.mount(fs.combine(dir, path), 'urlfs', entry.url)
			node.size = entry.size
		end
	end
end

return gitfs