Skip to content

liudng/dev

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dev - Lightweight Bash Scripts Manager

License

For large and complex software projects need to setup the development environment, including software installation dependents, clone source code repository, manage a large number of scripts, custom configuration files, and so on.

The goal of dev is to make these things easier.

This documentation assumes you are already familiar with Bash. If you do not know anything about Bash, consider familiarizing yourself with the general terminology and features of Bash before continuing.

Featues

  • Writen in pure bash.
  • Modular.
  • Lightweight.

Installation

Clone the dev repository to a local directory:

git clone git@github.com:liudng/dev.git ~/dev

Add ~/dev/bin to the PATH variable:

echo "export PATH=$PATH:~/dev/bin" >> ~/.bashrc

Or link ~/dev/bin/dev.bash to a PATH directory:

ln -s ~/dev/bin/dev.bash ~/.local/bin/dev
ln -s ~/dev/bin/dev-bootstrap.bash ~/.local/bin/dev-bootstrap.bash

Create a configuration file:

cp ~/dev/etc/dev.conf.example ~/dev/etc/dev.conf

If you want to use the command auto completion, run the following command:

cat ~/dev/share/completion.bash >> ~/.bash_completion

The installation is complete, enter dev --help at the command line to see how to use it.

Usage

dev [--sudo] [--trace] [--verbose] <cmd-file> <cmd-function> [arguments...]
dev [--help] [--version]

dev's custom commands are saved in the cmd directory, and the file extension must be .bash, In the help topic it is named cmd-file. In each command file, cmd-function is prefixed with cmd_.

Example

Type the folloing command:

dev examples/example helloworld

Output:

Hello world!

Custom Command Example

Create a new command to copy the following text to the file ~/dev/cmd/demo.bash:

cmd_helloworld() {
    echo "Hello world!"
}

And then type the following command to run:

dev demo helloworld

Output:

Hello world!

In the above command, demo is cmd-file. helloworld is cmd-function.

You can save all project-related commands in the cmd directory.

More examples, see the files in th cmd directory.

The Library Scripts

Import a library script to current command file, Add following line to file start:

dev_import dev file

It will load the script file from dev project's lib/file.bash.

Global Variables Reference

  • $dev_global_project The project name.
  • $dev_global_base The project base directory.

Global Functions Reference

  • dev_import Import a library file to current file.
  • dev_run

Multi-project

Using dev to manage multiple projects is very easy.

...

More project examples, see the sys project.

Copyright

Copyright 2018 The dev Authors. All rights reserved.

Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.