go |cli

letstry - a tool for quickly creating disposable work spaces from the cli

nathanfiscaletti

Nathan Fiscaletti

Posted on November 14, 2024

letstry - a tool for quickly creating disposable work spaces from the cli

View on GitHub

letstry is a powerful tool designed to provide temporary work-spaces for developers, built in Golang. It allows you to quickly create new projects, save them as templates, and export them to a more permanent location.

Installation

Letstry requires Go to be installed on your system. If you do not have Go installed, you can download it from the official website.

Once Go is installed, to install letstry, run the following command:

$ go install github.com/nathan-fiscaletti/letstry/cmd/letstry@latest
Enter fullscreen mode Exit fullscreen mode

If you'd rather use the lt alias, you can install it using the following command:

$ go install github.com/nathan-fiscaletti/letstry/cmd/lt@latest
Enter fullscreen mode Exit fullscreen mode

Usage

Creating a new Session

Creating a new session with letstry is simple and efficient. Use the lt new command to initialize a temporary project directory and open it in the default editor. This allows for quick prototyping. If you like the results, you can export the session to a more permanent location or save it as a template.

$ lt new
Enter fullscreen mode Exit fullscreen mode

If the VSCode window is closed, the temporary directory will be deleted. Therefore, you should either export your project using lt export <path> or save it as a template using lt save <template-name>.

Lets try sessions can be created from a directory path, a git repository URL, or a template name.

$ lt new <repository-url>
$ lt new <directory-path>
$ lt new <template-name>
Enter fullscreen mode Exit fullscreen mode

Exporting a Session

To export a session, use the lt export command from within the sessions directory. This will copy the session to the directory you specify.

$ lt export <path>
Enter fullscreen mode Exit fullscreen mode

Listing active sessions

To list all active sessions, use the lt list command.

$ lt list
Enter fullscreen mode Exit fullscreen mode

Managing Templates

Creating a template

Templates are a powerful feature of letstry. They allow you to save a project as a template and quickly create new projects based on that template.

To save an active session as a template, use the lt save command from within the sessions directory.

$ lt save [name]
Enter fullscreen mode Exit fullscreen mode

If the session was initially created from an existing template, you can omit the name argument and the original template will be updated with the new session.

Importing a Template

You can easily import git repositories as templates using the lt import command.

$ lt import <template-name> <repository-url>
Enter fullscreen mode Exit fullscreen mode

Listing Templates

To list all available templates, use the lt templates command.

$ lt templates
Enter fullscreen mode Exit fullscreen mode

Deleting a Template

To delete a template, use the lt delete-template command.

$ lt delete-template <name>
Enter fullscreen mode Exit fullscreen mode

Configuration

letstry can be configured using a configuration file. The configuration file is located at ~/.letstry/config.json.

The config file allows you to specify different editors if you do not use VSCode.

Windows Config Example

~/.letstry/config.json

{
    "default_editor": "vscode",
    "editors": [
        {
            "name": "vscode",
            "run_type": "run",
            "path": "C:\\Users\\natef\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe",
            "args": "-n",
            "process_capture_delay": 2000000000,
            "tracking_type": "file_access"
        }
    ]
}
Enter fullscreen mode Exit fullscreen mode

Contributing

We welcome contributions to improve letstry. If you have suggestions or bug reports, please open an issue or submit a pull request.

Development

To install letstry for development, run the following command from the root of the project:

$ go install ./...
Enter fullscreen mode Exit fullscreen mode

Attaching a Debugger in VSCode

To attach a debugger in VSCode you will first need to configure the command line arguments with which you wish the application to be launched. You can do this in the ./.vscode/launch.json file.

Then open the Run and Debug tab in VSCode (Ctrl+Shift+D on Windows) and select the Launch Go Program configuration.

License

This project is licensed under the MIT License.

💖 💪 🙅 🚩
nathanfiscaletti
Nathan Fiscaletti

Posted on November 14, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related