Related is a simple cli utility tool to create files or a group of files.

Go Report Card

Related - Create files based on individual definitions or groups

Related helps with common file-creation-based tasks. You can predefine single types as well as groups. Scripts (lua, binary, javascript [needs node]) can be executed pre/post file creation as well as pre/post groups.

Installation

Download binary for your platform from the releases here or simply build from source.

Usage

!! You can use either _.json or _.yaml for configuration files !!

Place a "(.)related.json" file in your project folder. You can also place <file>.json files in the .related folder. Wherever you like. Paths should be relative to the .related or config/related folder though. Type and group names can't be ambiguous, Related will check this on start.

Splitting into multiple config files can help with organization.

Content example:

{
    "types": [
        {
            "name": "component",
            "template": "typescript/NextFuncComponent.tmpl",
            "path": "",
            "pre": "typescript/MyCustomJS.lua",
            "post": "typescript/MyCustomPostScript.lua",
            "suffix": ".tsx"
        },
        {
            "name": "cssmodule",
            "path": "styles",
            "suffix": ".module.css"
        }
    ],
    "groups": [
        {
            "name": "component",
            "types": ["component", "cssmodule"],
            "pre": "typescript/MyCustomGroupPreScript",
            "post": "typescript/MyCustomGroupPostScript"
        }
    ]
}

If no template is provided, the file will be empty.

Type-Inheritance

You can inherit types like this:

types:
    - name: parent
      suffix: .tsx
      path: components
      template: typescript/rfc.tmpl
    - name: parent/other
      path: othercomponents

The path will be relative to the parent type, so in this case the path of parent/other will be components/othercomponents. Parents can be any type defined wherever. They don't have to be in the same file.

Important: properties can be set to an empty string by overwriting it with CLEAR, so f.e. path: CLEAR will set the path to "" instead of "components"

Commands

Command Function
list <scripts,templates,groups,types> <parent if scripts or templates> Lists all available template/scripts, grouped by parent-folder, or groups and types. The parent is optional for listing templates/scripts.
<type or group> <name> <filename> Creates the file(s) based on the type or group provided

Custom Files

Custom files like templates or scripts can be either placed in a .related folder near the config or in a related folder in your users config directory. Templates must be placed inside templates and scripts inside scripts. You can nest further.

Related will prioritize project-level files over config ones.

Templates

Templates are vanilla Golang templates. Data passed to templates:

data read via
working directory {{.workingDir}}
path {{.path}}
name {{.name}}
suffix {{.suffix}}

Scripts

The following types are executable: lua scripts, javascript (via node), and binaries.

You can execute scripts by settings pre- and post-scripts in the type or group definition. Related will look for the script and execute it according to the lifecycle.

Passed command-line arguments:

  1. current working directory
  2. path
  3. filename
  4. suffix

Hints

  1. A failure creating a single type won't result in the whole group-creation aborting. This means if f.e. you create a single type and later want to create a group but the type has already been created, it'll simply print out an error and continue creating the rest of the types.
  2. A failures trying to execute a script will result in abortion of the type at that certain lifecycle. F.e. a failure in a script running pre-creation will stop the creation process there.
Similar Resources

tinygo-used-files is a CLI tool that lists only the files to be built as specified by buildtag.

tinygo-used-files is a CLI tool that lists only the files to be built as specified by buildtag.

Feb 6, 2022

Got: Simple golang package and CLI tool to download large files faster 🏃 than cURL and Wget!

Got. Simple and fast concurrent downloader. Installation ❘ CLI Usage ❘ Module Usage ❘ License Comparison Comparison in cloud server: [root@centos-nyc-

Dec 29, 2022

High level CLI utility for restic

High level CLI utility for restic

High level CLI utility for restic

Dec 26, 2022

Utility CLI to convert Spring Boot Yaml configuration into external configuration

boot-config-export Utility CLI to convert Spring Boot Yaml configuration into external configuration (as environment variables). The variables are tra

Nov 17, 2021

Go library and CLI utility for /etc/hosts management.

Go library and CLI utility for /etc/hosts management.

Etc Hosts Management Utility & Go Library /etc/hosts Management It is easy to open your /etc/hosts file in text editor and add or remove entries. Howe

Nov 27, 2022

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

✨ Create a new production-ready project with backend, frontend and deploy automation by running one CLI command!

✨ Create a new production-ready project with backend, frontend and deploy automation by running one CLI command!

✨ Create a new production-ready project with backend, frontend and deploy automation by running one CLI command!

Dec 31, 2022

GitHub CLI extension to create and revoke installation tokens

GitHub CLI extension to create and revoke installation tokens.

Nov 22, 2021
ag is a tool for defining an alias for a group of commands

AG Introduction ag is a command line tool that similar to Makefile. with ag you can make an alias for group of commands with custom flags. This tool i

Jul 17, 2022
Script to check open slot for 18+ age group in particular district and pin code area

Running instruction install go: 1.14 (might work with other versions as well) install following library for sending notifications go get -u github.com

Mar 22, 2022
Easy to use library and CLI utility to generate Go struct from CSV files.

csv2struct Easy to use library and CLI utility to generate Go struct from CSV files. As a benefit, it's fully compatible with csvutil. So, structs gen

Nov 7, 2022
Commandline Utility To Create Secure Password Hashes (scrypt / bcrypt / pbkdf2)

passhash Create Secure Password Hashes with different algorithms. I/O format is base64 conforming to RFC 4648 (also known as url safe base64 encoding)

Oct 10, 2022
Rpfaudio - A small opinionated cli to create Readium Audiobooks from a directory containing mp3 files

rpfaudio A small opinionated cli to create Readium Audiobooks from a directory c

Feb 18, 2022
A dead simple cli utility to help you manage your git stash
A dead simple cli utility to help you manage your git stash

A dead simple cli utility to help you manage your git stash.

Aug 2, 2022
Node is where client will send data to, create block send to miner, create block send to parent and receive tick from validator and do validate

Node Receive Tick from validator Validate POH of tick send result to validator Receive confirm block from validator Send Checked block to validator Ho

Dec 31, 2021
A CLI tool that you can use create regular backups of your Notion.so Pages.

notion-offliner A CLI tool that you can use create regular backups of your Notion.so Pages. Perfect for disaster scenarios and offline usage. MacOS an

Jan 3, 2023
Branch is a small CLI tool to automatically create git branches based on tickets

________ ________ ________ ________ ________ ___ ___ |\ __ \ |\ __ \ |\ __ \ |\ ___ \ |\ ___

Nov 15, 2022
Nebula Diagnosis CLI Tool is an information diagnosis cli tool for the nebula service and the node to which the service belongs.

Nebula Diagnosis CLI Tool is an information diagnosis cli tool for the nebula service and the node to which the service belongs.

Jan 12, 2022