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.
- Writen in pure bash.
- Modular.
- Lightweight.
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.
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_.
Type the folloing command:
dev examples/example helloworld
Output:
Hello world!
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.
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.
$dev_global_project
The project name.$dev_global_base
The project base directory.
dev_import
Import a library file to current file.dev_run
Using dev to manage multiple projects is very easy.
...
More project examples, see the sys project.
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.