]> git.phdru.name Git - m_librarian.git/commitdiff
Change options: -D|--database, -P|--path, -F|--format
authorOleg Broytman <phd@phdru.name>
Sat, 11 Jun 2016 00:19:34 +0000 (03:19 +0300)
committerOleg Broytman <phd@phdru.name>
Sat, 11 Jun 2016 00:26:05 +0000 (03:26 +0300)
docs-ru/command_line.rst
docs/command_line.rst
scripts/ml-import.py
scripts/ml-initdb.py
scripts/ml-search.py

index 84e12a0f94e8c6132ffd91f9678db60cfaef1a44..cbaad645d9d7acccc3a1dce9ebc33b6ef59003fd 100644 (file)
@@ -13,11 +13,11 @@ ml-initdb.py
 
 Использование::
 
 
 Использование::
 
-    ml-initdb.py [-d]
+    ml-initdb.py [-D]
 
 Опции::
 
 
 Опции::
 
-    -d, --database database  Использовать указанную БД
+    -D, --database database  Использовать указанную БД
 
 Инициализирует базу данных и импортирует список жанров. Этот скрипт не
 очень-то нужен, так как следующий скрипт делает всё указанное.
 
 Инициализирует базу данных и импортирует список жанров. Этот скрипт не
 очень-то нужен, так как следующий скрипт делает всё указанное.
@@ -28,11 +28,11 @@ ml-import.py
 
 Использование::
 
 
 Использование::
 
-    ml-import.py [-d] [file.inpx ...]
+    ml-import.py [-D] [file.inpx ...]
 
 Опции::
 
 
 Опции::
 
-    -d, --database database  Использовать указанную БД
+    -D, --database database  Использовать указанную БД
 
 Инициализирует базу данных, импортирует список жанров и список файлов
 INPX, перечисленных в командной строке. При повторных запусках не
 
 Инициализирует базу данных, импортирует список жанров и список файлов
 INPX, перечисленных в командной строке. При повторных запусках не
@@ -45,14 +45,14 @@ ml-search.py
 
 Использование::
 
 
 Использование::
 
-    ml-search.py [-d] [-i] [-I] [-t] [-s] [-f] [-v] [-c] ...
+    ml-search.py [-D] [-i] [-I] [-t] [-s] [-f] [-v] [-c] ...
 
 Программа выполняет поиск по базе данных и показывает список
 результатов. В настоящее время может искать только в списке авторов.
 
 Глобальные опции::
 
 
 Программа выполняет поиск по базе данных и показывает список
 результатов. В настоящее время может искать только в списке авторов.
 
 Глобальные опции::
 
-    -d, --database database  Использовать указанную БД
+    -D, --database database  Использовать указанную БД
     -i, --ignore-case        независимо от регистра (по умолчанию: угадать)
     -I, --case-sensitive     с учётом регистра
     -t, --start              тип поиска: подстрока в начале строки
     -i, --ignore-case        независимо от регистра (по умолчанию: угадать)
     -I, --case-sensitive     с учётом регистра
     -t, --start              тип поиска: подстрока в начале строки
@@ -122,7 +122,7 @@ ml-search.py
 
 Использование::
 
 
 Использование::
 
-    ml-search.py books [-t title] [-s series] [-a archive] [-f file] [-p path] [--format f] [--get] [--get-many N] [--id id] [--surname name] [--name name] [--misc-name name] [--fullname name] [--aid aid] [-e ext] [--eid eid] [--gname name] [--gtitle title] [--gid gid] [-l lang] [--lid lid]
+    ml-search.py books [-t title] [-s series] [-a archive] [-f file] [--id id] [--surname name] [--name name] [--misc-name name] [--fullname name] [--aid aid] [-e ext] [--eid eid] [--gname name] [--gtitle title] [--gid gid] [-l lang] [--lid lid] [-P path] [-F format] [--get] [--get-many N]
 
 Искать и печатать список книг по заголовку, серии, архиву, имени файла.
 
 
 Искать и печатать список книг по заголовку, серии, архиву, имени файла.
 
@@ -132,10 +132,6 @@ ml-search.py
     -s, --series серия     Искать по серии
     -a, --archive архив    Искать по имени архива (zip-файла)
     -f, --file файл        Искать по имени файла (без расширения)
     -s, --series серия     Искать по серии
     -a, --archive архив    Искать по имени архива (zip-файла)
     -f, --file файл        Искать по имени файла (без расширения)
-    -p, --path path        Путь к директории с архивами библиотеки
-    --format format        Формат имени сохраняемого файла
-    --get                  Загрузить ровно один файл
-    --get-many N           Загрузить не больше указанного числа файлов
     --id id                Искать по id книги
     --surname surname      Искать по фамилии автора
     --name name            Искать по имени автора
     --id id                Искать по id книги
     --surname surname      Искать по фамилии автора
     --name name            Искать по имени автора
@@ -149,6 +145,10 @@ ml-search.py
     --gid gid              Искать по id жанра
     -l, --lang lang        Искать по языку
     --lid lid              Искать по id языка
     --gid gid              Искать по id жанра
     -l, --lang lang        Искать по языку
     --lid lid              Искать по id языка
+    -P, --path path        Путь к директории с архивами библиотеки
+    -F, --format format    Формат имени сохраняемого файла
+    --get                  Загрузить ровно один файл
+    --get-many N           Загрузить не больше указанного числа файлов
 
 По умолчанию программы выводит список заголовков найденных книг. При
 использовании опции `-v` также выводится id из БД, список авторов и
 
 По умолчанию программы выводит список заголовков найденных книг. При
 использовании опции `-v` также выводится id из БД, список авторов и
@@ -158,7 +158,7 @@ ml-search.py
 выводятся имя архива, имя файла, расширение и размер файла, и признак,
 была ли книга помечена как удалённая.
 
 выводятся имя архива, имя файла, расширение и размер файла, и признак,
 была ли книга помечена как удалённая.
 
-Опция `-p` задаёт путь к директории с архивами библиотеки. По умолчанию
+Опция `-P` задаёт путь к директории с архивами библиотеки. По умолчанию
 этот путь берётся из файла конфигурации `m_librarian`, секция
 `[library]`, ключ `path`, например::
 
 этот путь берётся из файла конфигурации `m_librarian`, секция
 `[library]`, ключ `path`, например::
 
@@ -166,7 +166,7 @@ ml-search.py
     path = /var/lib/archives
 
 Опция полезна в ситуации работы с несколькими базами данных (глобальная
     path = /var/lib/archives
 
 Опция полезна в ситуации работы с несколькими базами данных (глобальная
-опция `-d`).
+опция `-D`).
 
 Опция `--get` позволяет загрузить книгу из библиотеки в файл. Опция
 позволяет загрузить ровно одну книгу, поэтому самый простой способ
 
 Опция `--get` позволяет загрузить книгу из библиотеки в файл. Опция
 позволяет загрузить ровно одну книгу, поэтому самый простой способ
@@ -197,7 +197,7 @@ ml-search.py
 в конец с точкой в качестве разделителя. Т.о. формат `%f` эквивалентен
 формату `%f.%e`.
 
 в конец с точкой в качестве разделителя. Т.о. формат `%f` эквивалентен
 формату `%f.%e`.
 
-Опция `--format format` позволяет указать формат в командной строке.
+Опция `-F|--format format` позволяет указать формат в командной строке.
 
 Опция `--get-many N` позволяет загрузить указанное число книг (не больше
 чем N, где N — целое число.) Опции `--get-many N` и `--get` взаимно
 
 Опция `--get-many N` позволяет загрузить указанное число книг (не больше
 чем N, где N — целое число.) Опции `--get-many N` и `--get` взаимно
index d91c3f50fc21f99e2555ad225bb4f73ae9d29947..99b5c8425ba0d3234af47f21eaf37774f880c4c3 100644 (file)
@@ -13,11 +13,11 @@ ml-initdb.py
 
 Usage::
 
 
 Usage::
 
-    ml-initdb.py [-d]
+    ml-initdb.py [-D]
 
 Options::
 
 
 Options::
 
-    -d, --database database  Open this database by pathname/db uri
+    -D, --database database  Open this database by pathname/db uri
 
 Initialize database and import genres list. Isn’t really needed as
 the next script does all that too.
 
 Initialize database and import genres list. Isn’t really needed as
 the next script does all that too.
@@ -28,11 +28,11 @@ ml-import.py
 
 Usage::
 
 
 Usage::
 
-    ml-import.py [-d] [file.inpx ...]
+    ml-import.py [-D] [file.inpx ...]
 
 Options::
 
 
 Options::
 
-    -d, --database database  Open this database by pathname/db uri
+    -D, --database database  Open this database by pathname/db uri
 
 Initialize database, import genres list and import a list of INPX files
 listed in the command line. On subsequent runs doesn’t destroy DB or
 
 Initialize database, import genres list and import a list of INPX files
 listed in the command line. On subsequent runs doesn’t destroy DB or
@@ -44,14 +44,14 @@ ml-search.py
 
 Usage::
 
 
 Usage::
 
-    ml-search.py [-d] [-i] [-I] [-t] [-s] [-f] [-v] [-c] ...
+    ml-search.py [-D] [-i] [-I] [-t] [-s] [-f] [-v] [-c] ...
 
 Search through the database and display results. Currently can only
 search authors by name.
 
 Global options::
 
 
 Search through the database and display results. Currently can only
 search authors by name.
 
 Global options::
 
-    -d, --database database  Open this database by pathname/db uri
+    -D, --database database  Open this database by pathname/db uri
     -i, --ignore-case        ignore case (default is to guess)
     -I, --case-sensitive     don’t ignore case
     -t, --start              search type: substring at the start
     -i, --ignore-case        ignore case (default is to guess)
     -I, --case-sensitive     don’t ignore case
     -t, --start              search type: substring at the start
@@ -119,7 +119,7 @@ Book searching and downloading
 
 Usage::
 
 
 Usage::
 
-    ml-search.py books [-t title] [-s series] [-a archive] [-f file] [-p path] [--format f] [--get] [--get-many N] [--id id] [--surname name] [--name name] [--misc-name name] [--fullname name] [--aid aid] [-e ext] [--eid eid] [--gname name] [--gtitle title] [--gid gid] [-l lang] [--lid lid]
+    ml-search.py books [-t title] [-s series] [-a archive] [-f file] [--id id] [--surname name] [--name name] [--misc-name name] [--fullname name] [--aid aid] [-e ext] [--eid eid] [--gname name] [--gtitle title] [--gid gid] [-l lang] [--lid lid] [-P path] [-F format] [--get] [--get-many N]
 
 Search and print a list of books by title, series, archive or file name.
 
 
 Search and print a list of books by title, series, archive or file name.
 
@@ -129,11 +129,6 @@ Options::
     -s, --series series    Search by series
     -a, --archive archive  Search by archive (zip file)
     -f, --file file        Search by file name (without extension)
     -s, --series series    Search by series
     -a, --archive archive  Search by archive (zip file)
     -f, --file file        Search by file name (without extension)
-    -p, --path path        Path to the directory with the library
-                           archives
-    --format format        Format of the downloaded file name
-    --get                  Download exactly one book
-    --get-many N           Download at most this many books
     --id id                Search by database id
     --surname surname      Search by author’s surname
     --name name            Search by author’s name
     --id id                Search by database id
     --surname surname      Search by author’s surname
     --name name            Search by author’s name
@@ -147,6 +142,11 @@ Options::
     --gid gid              Search by genre’s id
     -l, --lang lang        Search by language
     --lid lid              Search by language’s id
     --gid gid              Search by genre’s id
     -l, --lang lang        Search by language
     --lid lid              Search by language’s id
+    -P, --path path        Path to the directory with the library
+                           archives
+    -F, --format format    Format of the downloaded file name
+    --get                  Download exactly one book
+    --get-many N           Download at most this many books
 
 By default the program prints only titles of the found book. With one
 option `-v` it also prints database id, the list of authors and genres,
 
 By default the program prints only titles of the found book. With one
 option `-v` it also prints database id, the list of authors and genres,
@@ -156,14 +156,14 @@ it also prints the file date and language. With three `-v` it prints
 archive name, file name, extension and size, and flag if the book is
 marked to be deleted.
 
 archive name, file name, extension and size, and flag if the book is
 marked to be deleted.
 
-Option `-p` provides the path to the directory with the library
+Option `-P` provides the path to the directory with the library
 archives. By default the path is extracted from `m_librarian.conf`,
 section `[library]`, key `path`::
 
     [library]
     path = /var/lib/archives
 
 archives. By default the path is extracted from `m_librarian.conf`,
 section `[library]`, key `path`::
 
     [library]
     path = /var/lib/archives
 
-The option is useful for multiple databases (global option `-d`).
+The option is useful for multiple databases (global option `-D`).
 
 Option `--get` allows to download a book from the library to a local
 file. The option allows to download exactly one book. The simplest way
 
 Option `--get` allows to download a book from the library to a local
 file. The option allows to download exactly one book. The simplest way
@@ -193,7 +193,7 @@ Format must not end in directory separator (`/` or `\\`). If specifier
 unconditionally with a dot. That is, format `%f` is equivalent to
 `%f.%e`.
 
 unconditionally with a dot. That is, format `%f` is equivalent to
 `%f.%e`.
 
-Option `--format format` allows to overwrite this configuration value.
+Option `-F|--format format` allows to overwrite this configuration value.
 
 Option `--get-many N` allows to download many books (at most N, where N
 is an integer). Options `--get-many N` and `--get` are, of course,
 
 Option `--get-many N` allows to download many books (at most N, where N
 is an integer). Options `--get-many N` and `--get` are, of course,
index 066c5ccb6bf51bb1069c8487dc7e07571761b7aa..f154841f1742cee8719811dedbfc02779805c630 100755 (executable)
@@ -7,7 +7,7 @@ from m_librarian.inp import import_inpx
 
 if __name__ == '__main__':
     parser = argparse.ArgumentParser(description='Import')
 
 if __name__ == '__main__':
     parser = argparse.ArgumentParser(description='Import')
-    parser.add_argument('-d', '--database', help='database URI')
+    parser.add_argument('-D', '--database', help='database URI')
     parser.add_argument('inpx', nargs='+', help='INPX files to import')
     args = parser.parse_args()
 
     parser.add_argument('inpx', nargs='+', help='INPX files to import')
     args = parser.parse_args()
 
index 4dc71b5f9cb24ee5d223c6e455d7bbaed78f6270..f46b7c2bdb264561fb0b8bde407ea7a043d565e3 100755 (executable)
@@ -6,7 +6,7 @@ from m_librarian.glst import import_glst
 
 if __name__ == '__main__':
     parser = argparse.ArgumentParser(description='Init')
 
 if __name__ == '__main__':
     parser = argparse.ArgumentParser(description='Init')
-    parser.add_argument('-d', '--database', help='database URI')
+    parser.add_argument('-D', '--database', help='database URI')
     args = parser.parse_args()
 
     open_db(args.database)
     args = parser.parse_args()
 
     open_db(args.database)
index a6fe3e5e076c0d893748f0967db284acbf4cba6a..0742a53753067b154ea17ce3d7ce9c5873bcc13b 100755 (executable)
@@ -261,7 +261,7 @@ def _search_languages(case_sensitive, search_type, args):
 
 if __name__ == '__main__':
     main_parser = argparse.ArgumentParser(description='Search')
 
 if __name__ == '__main__':
     main_parser = argparse.ArgumentParser(description='Search')
-    main_parser.add_argument('-d', '--database', help='database URI')
+    main_parser.add_argument('-D', '--database', help='database URI')
     main_parser.add_argument('-i', '--ignore-case', action='store_true',
                              help='ignore case '
                              '(default is to guess)')
     main_parser.add_argument('-i', '--ignore-case', action='store_true',
                              help='ignore case '
                              '(default is to guess)')
@@ -294,12 +294,6 @@ if __name__ == '__main__':
     parser.add_argument('-s', '--series', help='search by series')
     parser.add_argument('-a', '--archive', help='search by archive (zip file)')
     parser.add_argument('-f', '--file', help='search by file name')
     parser.add_argument('-s', '--series', help='search by series')
     parser.add_argument('-a', '--archive', help='search by archive (zip file)')
     parser.add_argument('-f', '--file', help='search by file name')
-    parser.add_argument('-p', '--path', help='path to the library archives')
-    parser.add_argument('--format', help='download format, default is %f')
-    parser.add_argument('--get', action='store_true',
-                        help='download exactly one book')
-    parser.add_argument('--get-many', type=int,
-                        help='download at most this many books')
     parser.add_argument('--id', type=int, help='search by database id')
     parser.add_argument('--surname', help='search by author\'s surname')
     parser.add_argument('--name', help='search by author\'s name')
     parser.add_argument('--id', type=int, help='search by database id')
     parser.add_argument('--surname', help='search by author\'s surname')
     parser.add_argument('--name', help='search by author\'s name')
@@ -313,6 +307,13 @@ if __name__ == '__main__':
     parser.add_argument('--gid', type=int, help='search by genre\'s id')
     parser.add_argument('-l', '--lang', help='search by language')
     parser.add_argument('--lid', type=int, help='search by language\'s id')
     parser.add_argument('--gid', type=int, help='search by genre\'s id')
     parser.add_argument('-l', '--lang', help='search by language')
     parser.add_argument('--lid', type=int, help='search by language\'s id')
+    parser.add_argument('-P', '--path', help='path to the library archives')
+    parser.add_argument('-F', '--format',
+                        help='download format, default is %f')
+    parser.add_argument('--get', action='store_true',
+                        help='download exactly one book')
+    parser.add_argument('--get-many', type=int,
+                        help='download at most this many books')
     parser.set_defaults(func=_search_books)
 
     parser = subparsers.add_parser('ext', help='Search extensions')
     parser.set_defaults(func=_search_books)
 
     parser = subparsers.add_parser('ext', help='Search extensions')