update readme

This commit is contained in:
Adrien Marquès 2018-11-18 22:49:11 +01:00
parent b752906d15
commit a3b513a23b
1 changed files with 30 additions and 23 deletions

View File

@ -25,13 +25,14 @@ author: xdrm-brackets
* [1. Create build file](#1-create-build-file) * [1. Create build file](#1-create-build-file)
* [2. Run on the target](#2-run-on-the-target) * [2. Run on the target](#2-run-on-the-target)
* [II. Commands](#ii-commands) * [II. Commands](#ii-commands)
+ [1) Comments](#1-comments) + [1) Sections](#1-sections)
+ [2) Install/remove Packages](#2-installremove-packages) + [2) Comments](#2-comments)
+ [3) Setup configuration](#3-setup-configuration) + [3) Install/remove Packages](#3-installremove-packages)
+ [4) Service management](#4-service-management) + [4) Setup configuration](#4-setup-configuration)
+ [5) Custom scripts](#5-custom-scripts) + [5) Service management](#5-service-management)
+ [6) Copy files](#6-copy-files) + [6) Custom scripts](#6-custom-scripts)
+ [7) Aliases](#7-aliases) + [7) Copy files](#7-copy-files)
+ [8) Aliases](#8-aliases)
* [III. Path Expressions](#iii-path-expressions) * [III. Path Expressions](#iii-path-expressions)
+ [1) Syntax](#1-syntax) + [1) Syntax](#1-syntax)
+ [2) File Formats](#2-file-formats) + [2) File Formats](#2-file-formats)
@ -70,7 +71,7 @@ $ go get -u github.com/xdrm-brackets/nix-amer
###### 1. Create build file ###### 1. Create build file
The first step is to write your build file according to the installation you want. While writing your build file you can check the syntax by using the `-dry-run` command-line argument as follows : The first step is to write your build file according to the installation you want. While writing it you can check the syntax and validate instructions by using the `-dry-run` command-line argument as follows :
```bash ```bash
$ nix-amer -p apt-get -dry-run <path/to/build/file> $ nix-amer -p apt-get -dry-run <path/to/build/file>
@ -82,7 +83,7 @@ $ nix-amer -p apt-get -dry-run <path/to/build/file>
###### 2. Run on the target ###### 2. Run on the target
Once your build file is correct and fulfills your needs, you can log in to the target machine, install the nix-amer and run it with your build file. Nix-amer's rich and colorful command-line output will give you a good feedback to rapidly fix problems. Once your build file is correct and fulfills your needs, you can log in to the target machine, install nix-amer and run it with your build file. The rich and colorful command-line output will give you a good feedback to rapidly fix problems.
@ -94,17 +95,23 @@ Once your build file is correct and fulfills your needs, you can log in to the t
### II. Commands ### II. Commands
Your whole setup remains in 1 only build file. Each line contains one instruction, the list of instructions is listed below. Your whole setup remains in only one file. Each line contains one instruction, the list of instructions is listed below.
#### 1) Comments #### 1) Sections
Each line beginning with one of the following characters : `[`, `#` or `;` is considered a comment and is not interpreted. Each instruction is enclosed in a section (_cf. ini file format_), a section definition stands on a line where the name of the section is surrounded by `[` and `]`. Each section is executed in parallel ; the special section named `pre` is executed before every other.
#### 2) Install/remove Packages #### 2) Comments
Each line beginning with one of the following characters : `#` or `;` is considered a comment and is not interpreted.
#### 3) Install/remove Packages
These instructions allow you to interact with the package system available on your system. These instructions allow you to interact with the package system available on your system.
@ -122,7 +129,7 @@ Remove the listed packages. If more than one, use spaces to separate package nam
#### 3) Setup configuration #### 4) Setup configuration
This instruction allow you to set fields of configuration files without the need of an editor and in a developer-readable manner. This instruction allow you to set fields of configuration files without the need of an editor and in a developer-readable manner.
@ -134,7 +141,7 @@ Update a configuration file where \<expr\> is a dot-separated human-readable [pa
#### 4) Service management #### 5) Service management
These instructions allow you to interact with the service system (_cf. [systemd](https://github.com/systemd/systemd)_). These instructions allow you to interact with the service system (_cf. [systemd](https://github.com/systemd/systemd)_).
@ -145,7 +152,7 @@ Perform the action on services. If more than one, use spaces to separate service
#### 5) Custom scripts #### 6) Custom scripts
This instruction allows you to use custom scripts for complex operations. This instruction allows you to use custom scripts for complex operations.
@ -153,9 +160,9 @@ This instruction allows you to use custom scripts for complex operations.
run <script> run <script>
``` ```
Execute the executable located at the path \<script\>. If script is an [alias](#7-aliases) it will resolve to its path Execute the executable located at the path \<script\>. If script is an [alias](#8-aliases) it will resolve to its path
#### 6) Copy files #### 7) Copy files
This instruction allows you to copy files. This instruction allows you to copy files.
@ -167,7 +174,7 @@ Try to copy the file \<src\> to the path \<dst\>.
#### 7) Aliases #### 8) Aliases
The file format allows you to create aliases to file paths for more readability in the [path expression](#ii-path-expressions) or with the [`run` command](#5-custom-scripts). The file format allows you to create aliases to file paths for more readability in the [path expression](#ii-path-expressions) or with the [`run` command](#5-custom-scripts).
@ -195,7 +202,7 @@ The syntax is pretty fast-forward, it uses 2 levels (file, fields) to find your
| Field | Description | Example | | Field | Description | Example |
| --------- | :----------------------------------- | -------------------------- | | --------- | :----------------------------------- | -------------------------- |
| `location_or_alias` | Path to the configuration file to edit. The file will be created if not found. If the path is an [alias](#7-aliases) created before in the file, it will resolve to the alias value as a filename. | `/etc/nginx/nginx.conf`, `some-alias` | | `location_or_alias` | Path to the configuration file to edit. The file will be created if not found. If the path is an [alias](#8-aliases) created before in the file, it will resolve to the alias value as a filename. | `/etc/nginx/nginx.conf`, `some-alias` |
| `fields` | Dot-separated chain of strings that match a configuration field. If the field does not point to a raw field but an existing field container, the \<value\> will replace the group with a text value. | `AllowGroups`, `http.gzip` | | `fields` | Dot-separated chain of strings that match a configuration field. If the field does not point to a raw field but an existing field container, the \<value\> will replace the group with a text value. | `AllowGroups`, `http.gzip` |
> The `fields` is processed only for known file formats listed in this [section](#2-file-formats). > The `fields` is processed only for known file formats listed in this [section](#2-file-formats).
@ -212,9 +219,9 @@ Configuration files can be written according to some standards or application-sp
- [yaml](https://en.wikipedia.org/wiki/YAML) with [go-yaml/yaml](https://github.com/go-yaml/yaml). - [yaml](https://en.wikipedia.org/wiki/YAML) with [go-yaml/yaml](https://github.com/go-yaml/yaml).
- [ini](https://en.wikipedia.org/wiki/INI_file) with [go-ini/ini](https://github.com/go-ini/ini). - [ini](https://en.wikipedia.org/wiki/INI_file) with [go-ini/ini](https://github.com/go-ini/ini).
- [nginx configurations](https://docs.nginx.com/nginx/admin-guide/basic-functionality/managing-configuration-files/) with [my own library](https://godoc.org/github.com/xdrm-brackets/nix-amer/internal/cnf/parser/nginx).
- [nginx configurations](https://docs.nginx.com/nginx/admin-guide/basic-functionality/managing-configuration-files/) with [my own library](https://godoc.org/github.com/xdrm-brackets/nix-amer/internal/cnf/parser/nginx). - [bash sourced configurations]() with [my own library](https://godoc.org/github.com/xdrm-brackets/nix-amer/internal/cnf/parser/bash) (_e.g. ~/.bashrc_).
- _and more to come..._ - _and more to come..._