Skip to content
This repository has been archived by the owner on Dec 21, 2019. It is now read-only.
/ Luastow Public archive

A portable GNU Stow implementation in Lua

License

Notifications You must be signed in to change notification settings

Eroica/Luastow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Luastow

Luastow is a Lua implementation of GNU Stow.

I was looking for something like GNU Stow for Windows, and only found a Python implementation. However, since I mainly use Lua, and feel that it’s easier to just compile and link lua.exe on Windows than going down the rabbit hole that is Python’s Windows distribution, I re-created GNU Stow myself, and plan to extend it with features that I find useful for me as well.

Features/To-do List

  • ☑ Stow a directory.
  • ☑ Delete links of a stowed directory.
    Luastow doesn’t delete directories that end up empty after deleting links.
  • ☑ Better error management if a file that is being linked is already present in the target directory.
  • ☑ Restow a directory from anywhere instead of having to navigate to the luastow directory.
  • ☐ Merge info files commonly used in GNU-related programs.

Usage

Luastow can be executed like a Lua script. There’s an amalgamated version (using lua-amalg) inside luastow/bin/ that correctly sets up all required modules. You’ll just have to make it executable, and you can make Luastow stow itself, e.g.:

$ luastow/bin/luastow --target /usr/local luastow

But if you (like me) have luastow or stow directory inside /usr/local where you keep all your programs, you probably first want to copy it into that directory, navigate to it, and:

$ luastow/bin/luastow luastow
$ luastow -h
A portable GNU Stow implementation in Lua.

Arguments:
   source_dir            Source directory.

Options:
   -t <target>, --target <target>
                         Target directory. (default: ..)
   -D, --delete          Delete from luastow directory.
   -R, --restow          Restow source directory (remove from target directory, then stow into target directory again.
   -v, --verbose         Prints debug messages.
   -h, --help            Show this help message and exit.

If no --target is given, the default value will be the directory above the current directory (i.e. .., it will be expanded to an absolute path).

Debug messages can be made more verbose with -vv.

Requirements

Luastow currently needs:

  • LuaFileSystem
  • argparse

These packages are found in luarocks. I’ll add a rockspec file soon.

Disclaimer

Luastow was written on a free Saturday afternoon. I’ve used and tested it for me on OS X, but I’ll first want to add better error management and unit tests before I can deem it to be used safely.

License

See attached LICENSE file.

Luastow uses log.lua by rxi, licensed under the MIT License.

About

A portable GNU Stow implementation in Lua

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published