Skip to content
/ clam Public

Development tools for writing shell scripts

Notifications You must be signed in to change notification settings

Elsie19/clam

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Clam

A programming environment for shell scripts

Features

  • Header files with bash_preproc
  • Documentation generation with shdoc
  • Enforced, objective formatting with shfmt
  • Shellcheck to prevent potentially broken code from running
  • Creates binaries from your code with shc

Getting started

First, download bash_preproc and shdoc. Then download Clam with sudo make install. To create a project, run clam new {name}. You can edit src/main.sh as you want, and when you want to compile your project, run clam compile in the root of your project. You can also use clam run to run your project after compiling.

If your code ever gets too messy, and you want to format it, run clam fmt.

Headers

If you want to separate your code into libraries, you can use Clam's header capabilities (provided by bash_preproc). Standard headers are located in /usr/include/bash/, but you can use local headers.

Headers take two forms:

#include <global.sh>

#include "local.sh"

The <> and "" denote whether you want to use global headers or local headers, respectively. Local headers should be added to the src/ directory.

File tree:

.
└── src
    ├── main.sh
    └── msg.sh

Contents of main.sh:

#!/bin/bash

#include "msg.sh"

msg 'Hello world!'

Contents of msg.sh:

#!/bin/bash

function msg() {
    echo -e "> $*"
}

When compiled, the final file before being turned into a binary will look like this:

#!/bin/bash

function msg() {
    echo -e "> $*"
}

msg 'Hello world!'

Doc generation

Familiarize yourself with how to use shdoc first. When you are done creating your definitions, run clam docs to create markdown files with all your definitions in docs/${file}.md.

About

Development tools for writing shell scripts

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages