8 Commits
0.4.1 ... 0.4.2

Author SHA1 Message Date
a703dd375c fix docs and readme 2020-12-17 21:18:14 +03:00
2fbd9030eb Update README.md
Add CodeQL badge
2020-12-17 21:07:31 +03:00
75265509f3 Create codeql-analysis.yml 2020-12-17 20:59:36 +03:00
ab44e1c12d Update README.md 2020-12-11 16:16:14 +03:00
8d912597cf feat: add auto test (github actions) 2020-12-11 16:14:01 +03:00
60c08d2a2d Merge branch 'master' of https://github.com/GenZmeY/multini 2020-12-11 16:04:34 +03:00
96aa1540ab Update README.md 2020-11-09 21:29:47 +03:00
88d1ec4201 Update README.md 2020-11-09 21:07:26 +03:00
5 changed files with 84 additions and 26 deletions

34
.github/workflows/codeql-analysis.yml vendored Normal file
View File

@ -0,0 +1,34 @@
name: "CodeQL"
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
schedule:
- cron: '29 4 * * 2'
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
language: [ 'go' ]
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
- name: Autobuild
uses: github/codeql-action/autobuild@v1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1

23
.github/workflows/tests.yml vendored Normal file
View File

@ -0,0 +1,23 @@
name: tests
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: '1.13.0'
- name: Build
run: make -j $(nproc) && make test

View File

@ -1,8 +1,10 @@
# Multini
[![build](https://github.com/GenZmeY/multini/workflows/build/badge.svg)](https://github.com/GenZmeY/multini/actions)
[![GitHub top language](https://img.shields.io/github/languages/top/GenZmeY/multini)](https://golang.org)
[![GitHub](https://img.shields.io/github/license/genzmey/multini)](https://github.com/GenZmeY/multini/blob/master/LICENSE)
[![build](https://github.com/GenZmeY/multini/workflows/build/badge.svg)](https://github.com/GenZmeY/multini/actions?query=workflow%3Abuild)
[![tests](https://github.com/GenZmeY/multini/workflows/tests/badge.svg)](https://github.com/GenZmeY/multini/actions?query=workflow%3Atests)
[![CodeQL](https://github.com/GenZmeY/multini/workflows/CodeQL/badge.svg)](https://github.com/GenZmeY/multini/security/code-scanning)
[![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/GenZmeY/multini)](https://golang.org)
[![GitHub](https://img.shields.io/github/license/genzmey/multini)](LICENSE)
[![GitHub release (latest by date)](https://img.shields.io/github/v/release/GenZmeY/multini)](https://github.com/GenZmeY/multini/releases)
*Command line utility for manipulating ini files with duplicate key names.*
@ -39,7 +41,7 @@ Most implementations only support having one property with a given name in a sec
# Usage
```
Usage: multini [option]... ACTION ini_file [section] [param] [value]
Usage: multini [OPTION]... ACTION ini_file [section] [key] [value]
Actions:
-g, --get Get values for a given combination of parameters.
-s, --set Set values for a given combination of parameters.
@ -63,7 +65,7 @@ Options:
# Examples
**output a global value not in a section:**
`multini --get ini_file '' param`
`multini --get ini_file '' key`
**output section:**
`multini --get ini_file section`
@ -72,36 +74,36 @@ Options:
`multini --get ini_file`
**output value:**
`multini --get ini_file section param`
- if there are several parameters, a list of all values of this parameter will be displayed
`multini --get ini_file section key`
- if there are several keys, a list of all values of this keys will be displayed
**add/update a single parameter:**
`multini --set ini_file section parameter value`
- if there is no parameter, it will be added
- if the parameter exists, the value will be updated
- if the parameter exists and has several values, the parameter with the specified value will be set, the rest of the values will be deleted
**create/update a single key:**
`multini --set ini_file section key value`
- if there is no key, it will be added
- if the key exists, the value will be updated
- if the key exists and has several values, the key with the specified value will be set, the rest of the values will be deleted
**add a parameter with specified value:**
`multini --add ini_file section parameter value`
- if there is no parameter, it will be added
- if the parameter exists and does not have the specified value, the new value will be added
**add a key with specified value:**
`multini --add ini_file section key value`
- if there is no key, it will be added
- if the key exists and does not have the specified value, the new value will be added
- if the specified value repeats the existing one, no changes will be made
**delete all parameters with specified name:**
`multini --del ini_file section parameter`
**delete all keys with specified name:**
`multini --del ini_file section key`
**delete a parameter with specified name and value:**
`multini --del ini_file section parameter value`
**delete a key with specified name and value:**
`multini --del ini_file section key value`
**delete a section:**
`multini --del ini_file section`
**short options can be combined:**
`multini -gq ini_file section parameter value`
- check the existence of a parameter with a given value using the return code
`multini -gq ini_file section key value`
- check the existence of a key with a given value using the return code
# License
Copyright © 2020 GenZmeY
The content of this repository is licensed under [MIT License](https://github.com/GenZmeY/multini/blob/master/LICENSE).
The content of this repository is licensed under [MIT License](LICENSE).

View File

@ -40,7 +40,7 @@ var (
func printHelp() {
output.Println("A utility for manipulating ini files with duplicate keys")
output.Println("")
output.Println("Usage: multini [OPTION]... [ACTION] config_file [section] [param] [value]")
output.Println("Usage: multini [OPTION]... [ACTION] config_file [section] [key] [value]")
output.Println("Actions:")
output.Println(" -g, --get Get values for a given combination of parameters.")
output.Println(" -s, --set Set values for a given combination of parameters.")
@ -55,7 +55,6 @@ func printHelp() {
output.Println(" This is not atomic but has less restrictions")
output.Println(" than the default replacement method.")
output.Println(" -o, --output FILE Write output to FILE instead. '-' means stdout")
// output.Println(" -v, --verbose Indicate on stderr if changes were made")
output.Println(" -u, --unix Use LF as end of line")
output.Println(" -w, --windows Use CRLF as end of line")
output.Println(" -q, --quiet Suppress all normal output")

View File

@ -1,6 +1,6 @@
A utility for manipulating ini files with duplicate keys
Usage: multini [OPTION]... [ACTION] config_file [section] [param] [value]
Usage: multini [OPTION]... [ACTION] config_file [section] [key] [value]
Actions:
-g, --get Get values for a given combination of parameters.
-s, --set Set values for a given combination of parameters.