comfy is a flexible command script manager / runner written in Rust

Related tags

Command-line comfy
Overview

comfy script

comfy is a cross-platform command script manager / runner tool, which allows you to run commands in the command line itself, but being these predefined in a portable and universal .comfy file.
.comfy files are plain text, but with some arguments so comfy parser understands what do you want to do.

System Clauses

Comfy allows you to write system independant scripts while minimizing code reproduction by allowing you to arbitrarily specialize sections of the script which are system dependant, while using cross platform code for sections that are not.

// this is a comment
> linux
echo linux system!
> windows
echo windows system!
> always
echo this always runs!
@ sleep 2000
echo you waited 2000 ms!

As you are thinking, the above code only runs the commands, that should be run, depending on the environment in which the script is run. Also, keep in mind that everything after always clause will run on any operating system. comfy automatically detects the system, and, being programmed in Rust, allows the specification of the following systems:

  • linux
  • macos
  • freebsd
  • solaris
  • android
  • windows
  • others

Not to mention that you can intertwine different system clauses, like this:

> linux
echo Linux user here!
> windows
echo Windows user here!
> linux
echo Linux user here! x2
> windows
echo Windows user here! x2

If you are on Linux, output should be:

Linux user here!
Linux user here! x2

Universal Functions

comfy also has some universal functions, they work on any system regardless of the installed libraries. comfy comes with several packaged libraries, so far, we have the following universal functions:

  • @ sleep [int] (ms)
  • @ print [str] (text)

Basic Usage

By defaut comfy will try to run a script named run.comfy in your current working directory. If That file does not exist it will tell you so and exit. comfy has the following command line arguments:

Command Use
--help Prints this message or the help of the given subcommand(s)
--helpf Scripting help
run Run a script
run --c Show comments from source while running

If you are on a unix-like system also have the option, with cargo install, to make the script itself runnable like so:

First you will need to make sure you have comfy installed:

cargo install --git https://github.com/dacousb/comfy

# and then take note of its installation location
which comfy

You can then write your script. Replace comfy in the example below (on the first line) with the installation loation noted before.

#!comfy run
> linux
echo Linux Executable Script!
> macos
echo But also works on Mac
> solaris
echo or Solaris!

and then you simply need to

# Once for each script you create (to enable the shebang on the first line)
chmod +x run.comfy

# To run the script (the ./ is important)
./run.comfy
You might also like...
A Rust-based shell script to create a folder structure to use for a single class every semester. Mostly an excuse to use Rust.

A Rust Course Folder Shell Script PROJECT IN PROGRESS (Spring 2022) When completed, script will create a folder structure of the following schema: [ro

Replace an app's icon from a png with a single terminal script. Made with Rust

Replace macOS App Icon Replace an app's icon from a png with a single terminal CLI. Made with Rust

Fix the simple rust script as shown in README.md
Fix the simple rust script as shown in README.md

Rust Fix Me Steps Create a Github account. (If you already have one no issues) Star this repository. Fork this repository to your Github account. Clon

A small script in rust to get the cpu usage in %'s with a gradient color for the text
A small script in rust to get the cpu usage in %'s with a gradient color for the text

cpu_usage-polybar A small script in rust to get the cpu usage in %'s with a gradient color for the text To get it to work on your PC you will have to

Opinionated set of extensions for use with rust-script

rust-script-ext Opinionated set of extensions for use with rust-script. Using rust-script to run Rust like a shell script is great! This crate provide

An elegant language for script-kiddies and terminal squatters.

Tonic An elegant language for script-kiddies and terminal squatters. About I started Tonic to complete the Advent of Code 2021. My eventual goal is to

❗️ Small script to view GitHub notifications in the terminal
❗️ Small script to view GitHub notifications in the terminal

github-notifications Small script to view GitHub notifications in the terminal Shows and color-codes the notification source, eg if you're the owner o

Cargo script subcommand

cargo-script cargo-script is a Cargo subcommand designed to let people quickly and easily run Rust "scripts" which can make use of Cargo's package eco

Write a simple CLI script, that when given a 64-byte encoded string

Write a simple CLI script, that when given a 64-byte encoded string, it finds a suitable 4-byte prefix so that, a SHA256 hash of the prefix combined with the original string of bytes, has two last bytes as 0xca, 0xfe. Script should expect the original content of the string to be passed in hexadecimal format and should return two lines, first being the SHA256 string found and second 4-byte prefix used (in hexadecimal format).

Releases(v0.5.5)
  • v0.5.5(Jul 30, 2021)

  • v0.5.4(Apr 29, 2021)

  • v0.5.4-beta(Apr 24, 2021)

    New features:

    • New _if clause allows you to introduce simple comparing logics in your scripts
    • \n is now a break line in @ print built-in function
    • helpf argument is now more documented

    Other:

    • Reformulated parser.rs logic, lots of bugs solved with that
    • clippy warnings
    Source code(tar.gz)
    Source code(zip)
  • v0.5.3-beta(Apr 18, 2021)

    New features:

    • Now, you can save the output of a command into the sysvar #-> echo Hello world! @ print {sys}
    • Now, you can format your comfy scripts with comfy fmt <name.comfy>
    • Added new information to the readme and the help/helpf command page

    Other:

    • clippy warnings
    Source code(tar.gz)
    Source code(zip)
  • v0.5.2-beta(Apr 14, 2021)

    New features:

    • sysvars (save them with # content and use them echo {sys})

    Bugs:

    • Solved a bug that avoided execution of commands that are not inside a system clause
    • Solved some optional clippy warnings
    • Other small changes
    Source code(tar.gz)
    Source code(zip)
  • v0.5.1-beta(Mar 27, 2021)

  • v0.5.0-beta(Mar 24, 2021)

    • Reformatted the way to execute scripts, use argument help for more information
    • Reformatted main.rs
    • Now, comfy uses structopt to parse the arguments
    Source code(tar.gz)
    Source code(zip)
  • v0.4.2-beta(Mar 21, 2021)

    The general comfy idea works as intended:

    • comfy detects the arguments correctly
    • comfy parser throws errors and warnings for the script syntax
    • The code is cross-platform
    Source code(tar.gz)
    Source code(zip)
Owner
daCoUSB
daCoUSB
Minimal, blazing fast Node.js script runner

nrr Minimal, blazing fast Node.js script runner. Why? nrr initializes and resolves scripts way faster than package managers. It achieves this by provi

Ryan Cao 3 Nov 17, 2023
Nvm - Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions

Node Version Manager Table of Contents Intro About Installing and Updating Install & Update Script Additional Notes Troubleshooting on Linux Troublesh

nvm.sh 63.8k Jan 7, 2023
Fast KubeJS script manager. Includes version control and compatibility with KJSPKG packages.

CarbonJS A KubeJS script manager Features ?? Super fast ⚙️ Version control ?? Constantly new scripts being added ✅ Easy to use ?? Compatibility with K

Krzysztof Poręba 3 May 9, 2023
A flexible simple theme manager for *nix systems

tema A theme manager for *nix systems respecting the FHS spec configuration As of now all the configuration is done via $XDG_CONFIG_HOME/tema/config.y

lb06 2 Sep 23, 2022
A small, interactive command runner

Dotree is a small interactive command runner. It wants to be a better home for your aliases and bash functions, especially those that you don't use th

Felix G. Knorr 113 Nov 14, 2023
Shellcode Runner/Injector in Rust using NTDLL functions directly with the ntapi Library

RustSCRunner Shellcode Runner/Injector in Rust using NTDLL functions directly with the ntapi Library. Surprisingly this is my first ever Rust project

null 86 Dec 18, 2021
A command line tool written in Rust and designed to be a modern build tool + package manager for C/C++ projects.

CCake CCake is a command line tool written in Rust and designed to be a modern build tool + package manager for C/C++ projects. Goals To be easily und

Boston Vanseghi 4 Oct 24, 2022
A wayland native, highly customizable runner.

anyrun A wayland native krunner-like runner, made with customizability in mind. Features Style customizability with GTK+ CSS More info in Styling Can

null 18 Jan 22, 2023
ABQ is a universal test runner that runs test suites in parallel. It’s the best tool for splitting test suites into parallel jobs locally or on CI

?? abq.build   ?? @rwx_research   ?? discord   ?? documentation ABQ is a universal test runner that runs test suites in parallel. It’s the best tool f

RWX 13 Apr 7, 2023