You can install confar
easily using the provided installation script by running it with the sh
command.
Note: Make sure you have a working internet connection before proceeding.
Open your terminal.
Download and run the installation script using sh
:
sh -c "$(curl -fsSL https://sanjairocky.github.io/confar/install.sh)"
or
Alternatively, you can use wget to download and execute the script:
sh -c "$(wget https://sanjairocky.github.io/confar/install.sh -O -)"
or
Alternatively, you can use pip to install:
pip install confar
To verify that confar is installed successfully, you can run the following command:
confar --version
confar parse <file>
confar run <file>
confar web
This documentation explains the structure of a YAML file used for configuring flows. The YAML file includes various flow configurations under the flows key.
The flows section defines different flow configurations, each identified by a unique name. Each flow consists of a list of steps that define the sequence of actions to be executed.
flows:
echo:
- name: shell exe
shell: pwd
# ...
default:
- name: calling flow
call: echo
# ...
# ...
The default flow is a special flow that defines the steps to execute when no specific flow is specified. It is used as a fallback.
The env section defines environment variables that can be used within steps of the flows.
env:
- name: shell with env
shell: echo {$.envd}
- name: env adding
env:
envd: ${PWD}-{$.obj[test]}
- name: shell with env
shell: echo {$.envd}
The if section defines conditional statements that determine whether to execute certain steps based on conditions.
if:
- name: conditional flow if
if: $.ar and not len($.ar)
then:
- name: passed hello
shell: echo {$.obj[test]}
# Scenario 1: Basic Shell Commands
flows:
echo:
- name: shell exe
shell: pwd
- name: shell with env
shell: echo {$.hello}
# Scenario 2: Conditional Flows
if:
- name: conditional flow if
if: $.ar and not len($.ar)
then:
- name: passed hello
shell: echo {$.obj[test]}
- name: conditional flow if .. else
if: $.hello
then:
- name: passed if
shell: echo "passed if"
else:
- name: passed if .. else
shell: echo "passed if .. else"
- name: conditional flow else .. if .. else
if: $.hello
then:
- name: passed hello
shell: echo "passed hello"
else:
- if: $.hello
then:
- name: passed if .. else
shell: echo "passed if .. else"
else:
- name: passed hello
shell: echo "passed hello"
# Scenario 3: Sub-Flows (including Default Flow)
flows:
default:
- name: calling flow
call: echo
- name: another step
shell: echo "Another step in the default flow"
# Scenario 4: Environment Variables
env:
- name: shell with env
shell: echo {$.envd}
- name: env adding
env:
envd: ${PWD}-{$.obj[test]}
- name: shell with env
shell: echo {$.envd}
This documentation provides an overview of the structure and purpose of the YAML configuration file used for defining flows and their associated actions. It can serve as a reference for users or developers working with these configurations.