stash a file or a tree of files for later reuse - a bit like git stash

Go Report Card Build Status

fstash

Stash a file or a tree of files for later reuse - a bit like git stash. Prebuilt binaries are available for Linux, Windows and Darwin. Just extract it somewhere inside your $PATH.

It skips .git directory.

test

Use this command:

$ go test -v *.go

usage story

Assume you write various applications and for each new project you add some initial files as the beginning skeleton. Also you replace some strings or expand some templates to add various information to the application, like author or other metadata.

This is one the of best fitting scenarios for using fstash. You create a stash from the skeleton files and then expand it whenever you are creating a new project. Also it is possible to provide the metadata to be injected into files.

As an example take a look at sample-stash directory. In this directory there is a Go file named variables.go. This file contains some variables that will be filled at compile time by Go compiler and come from build.sh file. Also there are two other variables Author and License which will be filled when we expand this stash for a new project.

First let’s create the stash:

$ cd sample-stash/
$ fstash create -n newproject

Now let’s create a new project which skeleton will be created from that stash:

$ cd ~/Documents/
$ mkdir newapp
$ cd newapp/
$ fstash expand -n newproject variables='{"Author":"Kaveh","License":"MIT"}'

Last command expands the stash we created in previous step, into current directory. The part variables='{"Author":"Kaveh","License":"MIT"}' indicates that variables.go is a (Go) text template file and the provided JSON should be passed to it as model data.

Now the content of variables.go is:

package main

// build flags
var (
        BuildTime  string
        CommitHash string
        GoVersion  string
        GitTag     string
)

// package info
const (
        Author  = "Kaveh"
        License = "MIT"
)

Tada! :)

I hope you find this tool useful.

Similar Resources

Hosty is a command-line utility that allows for fast inspection and editing of /etc/hosts-like files

Hosty Description Hosty is a command-line utility that allows for fast inspection and editing of /etc/hosts-like files. It is written in golang and us

Sep 3, 2021

πŸŽ„ A Christmas tree right from your terminal!

πŸŽ„ A Christmas tree right from your terminal!

ctree πŸŽ„ A Christmas tree right from your terminal! πŸ‘€ Demo βŒ› No Refresh Don't want the tree to refresh every 2 seconds? Easy! Just add the --no-refre

Dec 20, 2022

This is a Go Cli app that receives an string path to a log file, and based on it generates and prints in console an encoded polyline with the locations found in the log file.

This is a Go Cli app that receives an string path to a log file, and based on it generates  and prints in console an encoded polyline with the locations found in the log file.

GEOENCODE GO CLI APP DESCRIPTION This is a Go Cli app that receives an string path to a log file, and based on it generates and prints in console an e

Oct 1, 2021

This command line converts .webarchive file to resources embed .html file

webarchive-to-singlefile This command line converts Safari's .webarchive file to complete .html. Notice Only tested on MacOS. Google Chrome required.

Dec 30, 2022

CLI filters the contents of the csv file according to the filters from the another file.

filtercsv CLI filters the contents of the csv file according to the filters from the another file. Made to process big files by a lots of filters. By

Dec 2, 2021

✏️ CLI tool to split a file into smaller sub-files

filesplit CLI tool to split a file into smaller sub-files Build $ go build Usage filesplit [mode] [-F, --file] [-N, --number] Examples # Split foo.txt

Apr 20, 2022

Golang-based simple file server to serve files of the current working directory

fileserve Golang-based simple file server to serve static files of the current working directory File sharing in LAN or home network Web application t

Jan 9, 2022

lls is lightweight ls. Using lls, you can get a list of files in a directory that contains a large number of files.

lls lls is lightweight ls. Using lls, you can get a list of files in a directory that contains a large number of files. How? You allocate a buffer for

Dec 29, 2022

Watcher - A simple command line app to watch files in a directory for changes and run a command when files change!

Watcher - Develop your programs easily Watcher watches all the files present in the directory it is run from of the directory that is specified while

Mar 27, 2022
git-glimpse is a command-line tool that is aimed at generating a git prompt like the one from zsh-vcs-prompt.

Git GoGlimpse git-glimpse is a command-line tool that is aimed at generating a git prompt like the one from zsh-vcs-prompt. The particularity of this

Jan 27, 2022
Bit is a modern Git CLI
Bit is a modern Git CLI

bit is an experimental modernized git CLI built on top of git that provides happy defaults and other niceties: command and flag suggestions to help yo

Dec 28, 2022
Modern ls command with vscode like File Icon and Git Integrations. Written in Golang
Modern ls command with vscode like File Icon and Git Integrations. Written in Golang

logo-ls modern ls command with beautiful Icons and Git Integrations . Written in Golang Command and Arguments supported are listed in HELP.md Table of

Dec 29, 2022
A CLI to replace your git commit command, so your git message can partially follow the Conventional Changelog ecosystem
A CLI to replace your git commit command, so your git message can partially follow the Conventional Changelog ecosystem

COMMIT CLI A CLI to replace your git commit command, so your git message can partially follow the Conventional Changelog ecosystem. And yes, it is bui

Feb 9, 2022
TUI Flappy Bird. Itβ€˜s a lil bit jank tbh

EBIRD TUI Flappy Bird. It's a lil bit jank tbh. Build and Install Build dependen

Dec 22, 2021
Go-file-downloader-ftctl - A file downloader cli built using golang. Makes use of cobra for building the cli and go concurrent feature to download files.

ftctl This is a file downloader cli written in Golang which uses the concurrent feature of go to download files. The cli is built using cobra. How to

Jan 2, 2022
A simple single-file executable to pull a git-ssh repository and serve the web app found to a self-contained browser window

go-git-serve A simple single-file executable to pull a git-ssh repository (using go-git library) and serve the web app found to a self-contained brows

Jan 19, 2022
I like reading news but I also like the terminal. I am leaning and practicing my go.
I like reading news but I also like the terminal. I am leaning and practicing my go.

I made an api and didn't know how to use it. Screenshots The initial screen when you first run the app. The screen after you specify an id. This app u

Jan 14, 2022
Hasura-fzf - This command has a fzf-like UI that allows you to find and run the file version used by the hasura command

hasura-fzf This command has a fzf-like UI that allows you to find and run the fi

Sep 29, 2022