Compare commits
No commits in common. "master" and "0.4.1" have entirely different histories.
2
.github/workflows/binary-release.yml
vendored
2
.github/workflows/binary-release.yml
vendored
@ -23,7 +23,7 @@ jobs:
|
|||||||
go-version: '1.13.0'
|
go-version: '1.13.0'
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: make -j $(nproc) compile VERSION=${{ steps.get_version.outputs.VERSION }}
|
run: make -j $(nproc) compile
|
||||||
|
|
||||||
- name: create release
|
- name: create release
|
||||||
id: create_release
|
id: create_release
|
||||||
|
32
.github/workflows/codeql-analysis.yml
vendored
32
.github/workflows/codeql-analysis.yml
vendored
@ -1,32 +0,0 @@
|
|||||||
name: "CodeQL"
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [ master ]
|
|
||||||
pull_request:
|
|
||||||
branches: [ master ]
|
|
||||||
|
|
||||||
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
23
.github/workflows/tests.yml
vendored
@ -1,23 +0,0 @@
|
|||||||
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
|
|
||||||
|
|
111
README-ru.md
111
README-ru.md
@ -1,111 +0,0 @@
|
|||||||
# Multini
|
|
||||||
|
|
||||||
[](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)
|
|
||||||
|
|
||||||
[English](README.md), [Русский](README-ru.md)
|
|
||||||
|
|
||||||
*Утилита командной строки для манипулирования ini файлами с дублирующимися именами ключей.*
|
|
||||||
|
|
||||||
Скомпилированная версия multini доступна на [странице релизов](https://github.com/GenZmeY/multini/releases).
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
# Описание
|
|
||||||
Некоторые программы используют формат ini файлов допускающий повторяющиеся имена ключей.
|
|
||||||
Например игры основаные на [unreal engine](https://en.wikipedia.org/wiki/Unreal_Engine).
|
|
||||||
Это может выглядеть так (часть конфигурации Killing Floor 2):
|
|
||||||
```
|
|
||||||
[OnlineSubsystemSteamworks.KFWorkshopSteamworks]
|
|
||||||
ServerSubscribedWorkshopItems=2267561023
|
|
||||||
ServerSubscribedWorkshopItems=2085786712
|
|
||||||
ServerSubscribedWorkshopItems=2222630586
|
|
||||||
ServerSubscribedWorkshopItems=2146677560
|
|
||||||
```
|
|
||||||
Большинство реализаций поддерживают только одно свойство с заданным именем в секции. Если их несколько, будет обрабатываться только первый (или последний) ключ, чего в данном случае недостаточно. multini решает эту проблему.
|
|
||||||
|
|
||||||
**примечание:**
|
|
||||||
- multini чувствителен к регистру;
|
|
||||||
- кавычки вокруг значения не обрабатываются (multini считает их частью значения);
|
|
||||||
- многострочные значения не поддерживаются.
|
|
||||||
(но все это может измениться в будущем)
|
|
||||||
|
|
||||||
# Сборка и установка (вручную)
|
|
||||||
1. Установите [golang](https://golang.org), [git](https://git-scm.com/), [make](https://www.gnu.org/software/make/);
|
|
||||||
2. Клонируйте этот репозиторий: `git clone https://github.com/GenZmeY/multini`
|
|
||||||
3. Перейдите в каталог с исходниками: `cd multini`
|
|
||||||
4. Выполните сборку: `make`
|
|
||||||
5. Выполните установку: `make install`
|
|
||||||
|
|
||||||
# Использование
|
|
||||||
```
|
|
||||||
Использование: multini [ПАРАМЕТРЫ]... ДЕЙСТВИЕ ini_file [секция] [ключ] [значение]
|
|
||||||
Действия:
|
|
||||||
-g, --get Получить значения для заданной комбинации параметров.
|
|
||||||
-s, --set Установить значения для заданной комбинации параметров.
|
|
||||||
-a, --add Добавить значения для заданной комбинации параметров.
|
|
||||||
-d, --del Удалить указанную комбинацию параметров.
|
|
||||||
-c, --chk Показать ошибки парсинга указанного файла.
|
|
||||||
|
|
||||||
Параметры:
|
|
||||||
-e, --existing Для --set и --del завершить программу с ошибкой, если элемент остутствует.
|
|
||||||
-r, --reverse Для --add добавлять элемент в начало секции
|
|
||||||
-i, --inplace Перезаписывать исходный файл.
|
|
||||||
Это не атомарно, но требует меньше разрешений
|
|
||||||
чем способ по умолчанию с заменой файла.
|
|
||||||
-o, --output ФАЙЛ Записать результат в ФАЙЛ. '-' означает стандартный вывод
|
|
||||||
-u, --unix Использовать LF в конце строки
|
|
||||||
-w, --windows Использовать CRLF в конце строки
|
|
||||||
-q, --quiet Подавить весь вывод
|
|
||||||
-h, --help Отобразить страницу помощи
|
|
||||||
--version Отобразить версию
|
|
||||||
```
|
|
||||||
|
|
||||||
# Примеры
|
|
||||||
**вывести глобальное значение вне секции:**
|
|
||||||
`multini --get ini_file '' key`
|
|
||||||
|
|
||||||
**вывести секцию:**
|
|
||||||
`multini --get ini_file section`
|
|
||||||
|
|
||||||
**вывести список секций:**
|
|
||||||
`multini --get ini_file`
|
|
||||||
|
|
||||||
**вывести значение:**
|
|
||||||
`multini --get ini_file section key`
|
|
||||||
- если ключей несколько, отобразится список всех значений этих ключей
|
|
||||||
|
|
||||||
**создать/обновить ключ (в единственном экземпляре):**
|
|
||||||
`multini --set ini_file section key value`
|
|
||||||
- если ключа нет, он будет добавлен
|
|
||||||
- если ключ существует, значение будет обновлено
|
|
||||||
- если ключ существует и имеет несколько значений, будет установлен ключ с указанным значением, остальные значения будут удалены
|
|
||||||
|
|
||||||
**добавить ключ с указанным значением:**
|
|
||||||
`multini --add ini_file section key value`
|
|
||||||
- если ключа нет, он будет добавлен
|
|
||||||
- если ключ существует и не имеет указанного значения, будет добавлено новое значение
|
|
||||||
- если указанное значение повторяет существующее, никаких изменений не будет
|
|
||||||
|
|
||||||
**удалить все ключи с указанным именем:**
|
|
||||||
`multini --del ini_file section key`
|
|
||||||
|
|
||||||
**удалить ключ с указанным именем и значением:**
|
|
||||||
`multini --del ini_file section key value`
|
|
||||||
|
|
||||||
**удалить секцию:**
|
|
||||||
`multini --del ini_file section`
|
|
||||||
|
|
||||||
**короткие версии параметров можно комбинировать:**
|
|
||||||
`multini -gq ini_file section key value`
|
|
||||||
- проверить наличие ключа с заданным значением, используя код возврата
|
|
||||||
|
|
||||||
# Лицензия
|
|
||||||
Copyright © 2020 GenZmeY
|
|
||||||
|
|
||||||
[MIT License](LICENSE).
|
|
||||||
|
|
50
README.md
50
README.md
@ -1,14 +1,10 @@
|
|||||||
# Multini
|
# Multini
|
||||||
|
|
||||||
[](https://github.com/GenZmeY/multini/actions?query=workflow%3Abuild)
|
[](https://github.com/GenZmeY/multini/actions)
|
||||||
[](https://github.com/GenZmeY/multini/actions?query=workflow%3Atests)
|
[](https://golang.org)
|
||||||
[](https://github.com/GenZmeY/multini/security/code-scanning)
|
[](https://github.com/GenZmeY/multini/blob/master/LICENSE)
|
||||||
[](https://golang.org)
|
|
||||||
[](LICENSE)
|
|
||||||
[](https://github.com/GenZmeY/multini/releases)
|
[](https://github.com/GenZmeY/multini/releases)
|
||||||
|
|
||||||
[English](README.md), [Русский](README-ru.md)
|
|
||||||
|
|
||||||
*Command line utility for manipulating ini files with duplicate key names.*
|
*Command line utility for manipulating ini files with duplicate key names.*
|
||||||
|
|
||||||
A compiled version of multini is available on the [release page](https://github.com/GenZmeY/multini/releases).
|
A compiled version of multini is available on the [release page](https://github.com/GenZmeY/multini/releases).
|
||||||
@ -43,7 +39,7 @@ Most implementations only support having one property with a given name in a sec
|
|||||||
|
|
||||||
# Usage
|
# Usage
|
||||||
```
|
```
|
||||||
Usage: multini [OPTION]... ACTION ini_file [section] [key] [value]
|
Usage: multini [option]... ACTION ini_file [section] [param] [value]
|
||||||
Actions:
|
Actions:
|
||||||
-g, --get Get values for a given combination of parameters.
|
-g, --get Get values for a given combination of parameters.
|
||||||
-s, --set Set values for a given combination of parameters.
|
-s, --set Set values for a given combination of parameters.
|
||||||
@ -67,7 +63,7 @@ Options:
|
|||||||
|
|
||||||
# Examples
|
# Examples
|
||||||
**output a global value not in a section:**
|
**output a global value not in a section:**
|
||||||
`multini --get ini_file '' key`
|
`multini --get ini_file '' param`
|
||||||
|
|
||||||
**output section:**
|
**output section:**
|
||||||
`multini --get ini_file section`
|
`multini --get ini_file section`
|
||||||
@ -76,36 +72,36 @@ Options:
|
|||||||
`multini --get ini_file`
|
`multini --get ini_file`
|
||||||
|
|
||||||
**output value:**
|
**output value:**
|
||||||
`multini --get ini_file section key`
|
`multini --get ini_file section param`
|
||||||
- if there are several keys, a list of all values of this keys will be displayed
|
- if there are several parameters, a list of all values of this parameter will be displayed
|
||||||
|
|
||||||
**create/update a single key:**
|
**add/update a single parameter:**
|
||||||
`multini --set ini_file section key value`
|
`multini --set ini_file section parameter value`
|
||||||
- if there is no key, it will be added
|
- if there is no parameter, it will be added
|
||||||
- if the key exists, the value will be updated
|
- if the parameter 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
|
- 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
|
||||||
|
|
||||||
**add a key with specified value:**
|
**add a parameter with specified value:**
|
||||||
`multini --add ini_file section key value`
|
`multini --add ini_file section parameter value`
|
||||||
- if there is no key, it will be added
|
- if there is no parameter, it will be added
|
||||||
- if the key exists and does not have the specified value, the new value will be added
|
- if the parameter 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
|
- if the specified value repeats the existing one, no changes will be made
|
||||||
|
|
||||||
**delete all keys with specified name:**
|
**delete all parameters with specified name:**
|
||||||
`multini --del ini_file section key`
|
`multini --del ini_file section parameter`
|
||||||
|
|
||||||
**delete a key with specified name and value:**
|
**delete a parameter with specified name and value:**
|
||||||
`multini --del ini_file section key value`
|
`multini --del ini_file section parameter value`
|
||||||
|
|
||||||
**delete a section:**
|
**delete a section:**
|
||||||
`multini --del ini_file section`
|
`multini --del ini_file section`
|
||||||
|
|
||||||
**short options can be combined:**
|
**short options can be combined:**
|
||||||
`multini -gq ini_file section key value`
|
`multini -gq ini_file section parameter value`
|
||||||
- check the existence of a key with a given value using the return code
|
- check the existence of a parameter with a given value using the return code
|
||||||
|
|
||||||
# License
|
# License
|
||||||
Copyright © 2020 GenZmeY
|
Copyright © 2020 GenZmeY
|
||||||
|
|
||||||
The content of this repository is licensed under [MIT License](LICENSE).
|
The content of this repository is licensed under [MIT License](https://github.com/GenZmeY/multini/blob/master/LICENSE).
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ var (
|
|||||||
func printHelp() {
|
func printHelp() {
|
||||||
output.Println("A utility for manipulating ini files with duplicate keys")
|
output.Println("A utility for manipulating ini files with duplicate keys")
|
||||||
output.Println("")
|
output.Println("")
|
||||||
output.Println("Usage: multini [OPTION]... [ACTION] config_file [section] [key] [value]")
|
output.Println("Usage: multini [OPTION]... [ACTION] config_file [section] [param] [value]")
|
||||||
output.Println("Actions:")
|
output.Println("Actions:")
|
||||||
output.Println(" -g, --get Get values for a given combination of parameters.")
|
output.Println(" -g, --get Get values for a given combination of parameters.")
|
||||||
output.Println(" -s, --set Set values for a given combination of parameters.")
|
output.Println(" -s, --set Set values for a given combination of parameters.")
|
||||||
@ -55,6 +55,7 @@ func printHelp() {
|
|||||||
output.Println(" This is not atomic but has less restrictions")
|
output.Println(" This is not atomic but has less restrictions")
|
||||||
output.Println(" than the default replacement method.")
|
output.Println(" than the default replacement method.")
|
||||||
output.Println(" -o, --output FILE Write output to FILE instead. '-' means stdout")
|
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(" -u, --unix Use LF as end of line")
|
||||||
output.Println(" -w, --windows Use CRLF as end of line")
|
output.Println(" -w, --windows Use CRLF as end of line")
|
||||||
output.Println(" -q, --quiet Suppress all normal output")
|
output.Println(" -q, --quiet Suppress all normal output")
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
A utility for manipulating ini files with duplicate keys
|
A utility for manipulating ini files with duplicate keys
|
||||||
|
|
||||||
Usage: multini [OPTION]... [ACTION] config_file [section] [key] [value]
|
Usage: multini [OPTION]... [ACTION] config_file [section] [param] [value]
|
||||||
Actions:
|
Actions:
|
||||||
-g, --get Get values for a given combination of parameters.
|
-g, --get Get values for a given combination of parameters.
|
||||||
-s, --set Set values for a given combination of parameters.
|
-s, --set Set values for a given combination of parameters.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user