New project 'guile-stash'

Announcing Guile-Stash: A New Guile Scheme Utility for Symlink Management with Conflict Resolution

I’m excited to announce the release of Guile-Stash, a utility I’ve developed using Guile Scheme, designed to simplify the management of symbolic links (symlinks) with an added focus on conflict resolution. Guile-Stash allows users to create symlinks for files and directories, offering options to handle existing path conflicts interactively.

What is Guile-Stash?

Guile-Stash is a command-line tool that provides a straightforward way to create symlinks, especially when the potential for conflicts exists. It takes two primary arguments: --target, the directory where you wish to create the symlink, and --package-dir, the file or directory you’re linking to. Upon encountering a path conflict, Guile-Stash prompts the user to choose between overwriting the existing file or skipping the symlink creation, ensuring intentional and informed actions are taken.

Key Features:

  • Easy command-line argument parsing for specifying source and target paths.
  • Interactive conflict resolution: users can choose to overwrite or skip on a case-by-case basis.
  • Support for both file and directory symlinks.
  • Built with the robustness and flexibility of Guile Scheme.

Why Guile-Stash?

In my workflow, I often encountered the need to manage symlinks, sometimes leading to conflicts with existing files or directories. I wanted a tool that not only automated the creation of symlinks but also provided an intuitive way to handle conflicts. Thus, Guile-Stash was born, combining the power of Scheme with practical file management capabilities.

Developed as an alternative to GNU stow, and as a project to develop my own guile scheme knowledge. My first project of any kind in the programming space.

Getting Started

To get started with Guile-Stash, clone the repository from here, and ensure you have Guile installed on your system. Use the command below for a basic operation:

bash

guile -L . guile-stash.scm --target=<target-dir> --package-dir=<package-dir>

Contributing

Guile-Stash is open for contributions! Whether it’s adding new features, improving existing ones, or fixing bugs, all contributions are welcome. Please feel free to fork the repository, make your changes, and submit a pull request.

ToDo List

While Guile-Stash is fully functional, there’s always room for improvement. Here are a few items on my ToDo list:

  • Implement verbose and quiet output modes for better user control over command feedback.
  • Add support for logging actions taken during symlink creation and conflict resolution.
  • Enhance error handling to provide more descriptive messages and recovery suggestions.
  • Explore the possibility of undo functionality for reverted actions taken by the tool.
  • Use colors to differentiate parts of the output, such as errors (red), warnings (yellow), and success messages (green).

Feedback and Suggestions

Your feedback is invaluable to making Guile-Stash even better. Please don’t hesitate to share your thoughts, suggestions, or report issues you encounter. Together, we can make Guile-Stash a robust tool for everyone in the community.

Thank you for checking out Guile-Stash. I’m looking forward to your feedback and contributions!

8 Likes

Congrats on releasing Stash, this is really exciting!

I think it’d be awesome if someone could contribute a Guix package definition for it so that it might be added to the main Guix package repo.

Nice project. Where can I send issues and patches?

I am in the process of figuring that out @qeqpep . I’ll get back to you soonest with an answer.

Thanks

Congrats on the release, @Glenneth ! It can be a bit of a scary thing to let your project out in the open, in particular the first time. Well done, you!

Ask and ye shall (almost) receive:

(define-module (guix-packager)
  #:use-module (guix)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (gnu packages)
  #:use-module (guix build-system gnu)
  #:use-module (guix git-download))

(define-public guile-stash
  (package
    (name "guile-stash")
    (version "1.0")
    (source
      (origin
        (method git-fetch)
        (uri (git-reference
              (url "https://git.sr.ht/~glenneth/guile-stash/tree/master")
              (commit "master")))
        (file-name (git-file-name name version))
        (sha256 (base32 "1sm28xn8hm8hbw4klfrrdcybn8zk27lhrk1brph8bzcqs7s8n03k"))))
    (build-system gnu-build-system)
    (arguments (list 
                     #:test-target ""
                     #:tests? #f))
    (home-page "https://git.sr.ht/~glenneth/guile-stash/tree/master/item/guile-stash.scm")
    (synopsis "A command-line utility written in Guile Scheme for creating symbolic links (symlinks) for files and directories")
    (description "Create and manage symlinks with conflict resolution")
    (license license:gpl3+)))

;; This allows you to run guix shell -f guix-packager.scm.
;; Remove this line if you just want to define a package.
guile-stash

I used Guix Packager for this. Note: The license is incorrect; Guix Packager doesn’t seem to offer MIT and I don’t know if that’s a limitation in the guix licenses package or the Guix Packager. The license used in this package definition is GPL3+. Apart from that obvious violation, I believe this package definition should be usable?

1 Like

You can send patches or any issues to ~glenneth/guile-stash@lists.sr.ht.

I will update the readme.

Thanks

They call it expat; from licenses.scm:

;; Some people call it the MIT license. For clarification see:
;; https://www.gnu.org/licenses/license-list.html#Expat
(define expat
  (license "Expat"
           "http://directory.fsf.org/wiki/License:Expat"
           "https://www.gnu.org/licenses/license-list.html#Expat"))

I keep running into this myself.

2 Likes

Thanks! I tried asking the interwebs for answers to this. I guess taking a peek at the source files would have yielded better results :sweat_smile:

1 Like

I’ve used stow for a couple of months before switching to guix home. I liked stow’s simplicity but I did not like the fact that you had to replicate the directory structure, and with guix-home you can create the symlinked files programmatically, with I like a lot, but it involves the reconfigure step.

Could you elaborate on the specific workflow or use cases? I only have a few symlinks for external drives. It seems like an interesting project but I’m already using a dot files solution. I guess it is super useful for organizing directories, a few realistic examples would be great for illustrating this.

Some feedback just from the readme and code:

  • I like that it includes the link to the guile installation.
  • I like the interactive mode ( I will borrow this idea).
  • A bash script can be used to create an executable.
  • Maybe it could take a scm file as an argument with a description of the files to be symlinked (some guile-stash data format).
1 Like

Hey @mirkoh

It’s currently a work in progress. The end target will be to add the functionality of GNU Stow with additional features being added from users comments.

As for workflow and examples, I am working on expanding the functionality and will update the readme and additional documentation as the project progresses.

Your suggestions of using a bash script to execute and taking a .scm file as an argument is interesting and definitely worth investigating.

As the project develops I will be posting about it here.

Thanks.

Just in case you’re interested, @Glenneth , stow needs a new co-maintainer.

1 Like

Hey @paulwicking

I appreciate the heads-up. stow is written in Perl and I know nothing of Perl lol.

I have just pushed an update to the dev branch of guile-stash though

guile-stash

Check it out. I’d be interested in anyone’s feedback or suggestions.

Cheers.

1 Like

guix-home has home-dotfiles-service-type which links files according to stow algorithm. Also written in guile. It’s not an identical solution since its using guix file service to create the links, but thought you might be interested.

1 Like

Definitely @moto

Thanks. I’ll take a look

Cheers