Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
a703dd375c | |||
2fbd9030eb | |||
75265509f3 | |||
ab44e1c12d | |||
8d912597cf | |||
60c08d2a2d | |||
96aa1540ab | |||
88d1ec4201 |
34
.github/workflows/codeql-analysis.yml
vendored
Normal file
34
.github/workflows/codeql-analysis.yml
vendored
Normal 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
23
.github/workflows/tests.yml
vendored
Normal 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
|
||||
|
48
README.md
48
README.md
@ -1,8 +1,10 @@
|
||||
# Multini
|
||||
|
||||
[](https://github.com/GenZmeY/multini/actions)
|
||||
[](https://golang.org)
|
||||
[](https://github.com/GenZmeY/multini/blob/master/LICENSE)
|
||||
[](https://github.com/GenZmeY/multini/actions?query=workflow%3Abuild)
|
||||
[](https://github.com/GenZmeY/multini/actions?query=workflow%3Atests)
|
||||
[](https://github.com/GenZmeY/multini/security/code-scanning)
|
||||
[](https://golang.org)
|
||||
[](LICENSE)
|
||||
[](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).
|
||||
|
||||
|
@ -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")
|
||||
|
@ -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.
|
||||
|
Reference in New Issue
Block a user