Code Monkey home page Code Monkey logo

frs's Introduction

frs

frs is a command wrapper tool.

Install

cargo install --git https://github.com/Myriad-Dreamin/frs.git

Examples

Before examples:

alias frx = "frs run --"
Example 1: Execute with Build Command

Execute the build command using cmake before executing the c++ application.

myriad-dreamin.iris in ~/work/rust/frs
λ(default)
$ frs with command -- cmake --build cmake-build-debug --parallel 12 --target install
λ(default) :: exec(cmake)
$ frx src/bin/app
# cmake --build cmake-build-debug --parallel 12 --target install
[0/1] Install the project...
-- Install configuration: "Debug"
-- Installing: ./cmake-build-debug/include/absl/base/options.h
-- Installing: ./cmake-build-debug/include/absl/base/options.h
# src/bin/app
Running application...
Example 2: Execute in docker

Run command inside a container

myriad-dreamin.iris in ~/work/rust/frs
λ(default)
$ cat /etc/lsb-release /etc/os-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
...
UBUNTU_CODENAME=jammy
λ(default)
$ frs with docker ubuntu:18.04
λ(default) :: ctr(ubuntu:18.04)
$ frx cat /etc/lsb-release /etc/os-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
...
UBUNTU_CODENAME=bionic
Example 3: Execute with workdir and environemnt variables

Execute the command with specific environment variables in a specific working directory.

myriad-dreamin.iris in ~/work/rust/frs
λ(default)
$ frs with env ASAN_OPTIONS allow_addr2line=1
λ(default) :: env(ASAN_OPTIONS)
$ frs with workdir ~/work/rust/frs/.data/test-workdir
λ(default) :: env(ASAN_OPTIONS) :: workdir(..test-workdir)
$
Example 4: save and restore context

Save and restore context.

myriad-dreamin.iris in ~/work/rust/frs
λ(default) :: env(ASAN_OPTIONS)
$ frs save asan_option
λ(asan_option)
$ frs with context another_ctx
λ(another_ctx)
$ frs with context asan_option
λ(asan_option)
$ frs save app --namespace cpp_project
λ(cpp_project::app)
$ frs with context asan_option
λ(asan_option)
$
Example 5: Dry Run and Inspect Context

Check what's exactly running and the context.

myriad-dreamin.iris in ~/work/rust/frs
λ(frs_test)
$ frs inspect
# $ run "cmake --build cmake-build-debug --parallel 12 --target install"
# ! core::with_command "cmake --build cmake-build-debug --parallel 12 --target install"
# $ set "FRS_KEY"="test"
# ! core::with_env "FRS_KEY"="test"
# frs_env: FRS_VERSION=0.1.0
(cmake --build cmake-build-debug --parallel 12 --target install;
 (export FRS_KEY=test;
 (((( echo 'frs placeholder' ))))))
λ(frs_test)
$ frs run --show -- echo '$FRS_KEY'
(cmake --build cmake-build-debug --parallel 12 --target install;
 (export FRS_KEY=test;
 echo $FRS_KEY))

Usage

The cli for frs.

Usage: frs [COMMAND]

Commands:
  help     Print this message or the help of the given subcommand(s)
  inspect  Inspect context
  run      Run with context
  save     Save context
  with     Manipulate context

Extension

The frs with command can be extended using any programming language. To create an frs extension, you must create a program that reads the context either from a file system path or stdin and produces an exact context in JSON format.

λ(app)
$ frs with ext -- python script/activate.py -- customized_arguments...
λ(app) :: ext(python:activate)
$ python script/activate.py --from-file ~/.confg/frs/context/default/app.json customized_arguments... # the underlying command

The program should output a JSON object that represents the context, similar to the following example:

{"meta":{"step_log":[{"description":"core::context \"app\"","prompt":"activate ..\"app\""}]},...}

frs's People

Contributors

myriad-dreamin avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.