Commit Graph

28 Commits

Author SHA1 Message Date
bastimeyer f39eb13b8c docs: skip groups with only suppressed actions 2024-02-17 15:28:46 +01:00
bastimeyer 0acbca3af1 docs: fix custom ext_argparse Sphinx extension
- Move the `parser_helper()` function from `streamlink_cli.main`
  into the `streamlink_cli._parser` module
- Refactor `ext_argparse` and set default import paths
- Update import path in `build-shell-completions.sh`

Unfortunately, the `streamlink_cli._parser` module can't be excluded
from the sdist/wheel distributions, as packagers might build
shell completions from the installed `streamlink_cli` package
instead of using the pre-built shell completions included in the sdist
or building them from an editable install.
2024-02-09 01:38:39 +01:00
bastimeyer 1b57d51435 cli.argparser: metadata availability in plugins 2023-08-26 14:14:54 +02:00
bastimeyer 3b7ff2bc39 cli.output: path-only --player argument
- Remove support for custom player arguments from `--player`
- Set the `--player` argument's `type` to `pathlib.Path`
- Set return type of `find_default_player()` to `pathlib.Path`
- Update `--player` and `--player-args` help texts accordingly
- Update `PlayerOutput`:
  - Update constructor signature and add typing information
  - Rename `cmd` to `path` and remove support for player arguments
  - Always build list of arguments and remove Windows-specific logic
  - Properly tokenize player input value in `--player-args`
  - Log player argv instead of the player command-line string
- Fix now unneeded passthrough URL quotation in `streamlink_cli.main`
- Update docs and fix argparse docs extension
- Update tests and remove Windows-specific player argument tests
2023-07-02 21:08:41 +02:00
bastimeyer 0962a576e5 docs: fix option with value in argparse extension 2023-03-31 10:11:49 -07:00
bastimeyer 85ea235d13 chore: add "A" rules to ruff config 2023-02-20 14:10:06 -08:00
bastimeyer 57fa6f80e8 chore: add "COM" rules to ruff config 2023-02-09 10:26:50 -08:00
bastimeyer 9fd14e3f9d chore: add "Q" rules to ruff config 2023-02-09 10:26:50 -08:00
bastimeyer 0589750c8f options: deprecate global plugin arguments
- Raise `StreamlinkDeprecationWarning` when `is_global=True`
- Remove all global plugin arguments and replace them with simple
  option lookups on the Streamlink session instance
- Remove global argument detection in custom Sphinx plugins extension
- Remove supported plugins list from custom Sphinx argparse extension
  and remove respective setup from `setup_plugin_args` in the CLI module
- Add deprecation note to the docs
- Update tests
  - Check whether builtin plugins define global plugin arguments
  - Capture deprecation warnings
2023-02-03 10:21:31 -08:00
bastimeyer c5c88d082d ci: fix new flake8 5.0.0 linting issues 2022-07-31 18:45:38 +02:00
Mozi 1741c59d9d docs: put inline code to code blocks in examples
Only apply to the line starts with "^Example: ".
2022-07-21 00:02:58 +02:00
Mozi 0978f6b400 docs: use single-backtick inline code block
This will make the documentation more clear and informative both on the
  rendered webpages and in the manpage as well as the "--help" content.

- On webpages, we will get inline code blocks;
- In the manpage, we will get emphasized words (bold);
- In the help content, we will get words enclosed in single backticks.

This will help us remove reStructuredText markups from the docs.

About "\$A":
  "\\$A" has been put into a code block, so the single backslash will be
  displayed correctly in the help content. For rendered docs, escaping
  backslashes is now no longer required since we did it automatically.

---

A useless non-capturing group has been removed as per the suggestion:
  https://github.com/streamlink/streamlink/pull/4659#pullrequestreview-1042428950

  Thus,

Co-authored-by: bastimeyer <mail@bastimeyer.de>
2022-07-21 00:02:58 +02:00
Mozi fa7bf61132 docs: apply option links in indented lines
There are some lines starting with two or more spaces contain the
  options should be links. To achieve it, the following types of lines
  should not be processed:
  - Starting with two or more spaces followed by a "%(prog)s";
  - Starting with two or more spaces followed by a full-length option;
  - Starting with an "Example: ".
2022-07-21 00:02:58 +02:00
bastimeyer 5985f08570 cli: refactor nested argparse argument groups
- Use a custom mapping of parent->child argument group relations
  instead of calling `group.add_argument_group()` for creating
  a tree structure of argument groups (deprecated in Python 3.11)
- Override `parser.add_argument_group()` and add the `parent` keyword
  for being able to have nested argument group defintions
- Update custom `--help` format output
- Update the argparser Sphinx extension
- Fix tests
2022-07-12 09:42:09 -07:00
Mozi c3806e71d9 docs: make cross-link to "metadata variables" in cli docs 2022-06-24 06:48:18 +02:00
bastimeyer cc455586c5 ci: lint sphinx extensions and setup.py 2022-06-23 09:35:00 -07:00
bastimeyer 1ed85fcb24 cli: implement --logfile
- refactor streamlink_cli.main.{setup_logging,setup_console}
  and split into setup_logger_and_console and setup_signals
- add LOG_DIR to streamlink_cli.constants
- pass filename to logger.basicConfig
- re-use write stream of logger in ConsoleOutput
- fix escaped chars for percent-formatted argparse help strings in docs
- add tests
2021-05-31 12:39:26 -07:00
bastimeyer f5c19bb08f cli: move plugin args into their own args group
This adds a second layer of plugin argument groups, so that the docs can
show menu items for each plugin which makes finding them is easier.

- make the doc's argparse extension read argparse groups recursively
- override argparse.ArgumentParser.format_help and show nested groups
- fix/update tests
2020-12-10 11:57:53 -08:00
bastimeyer 51a391f720 docs: split CLI args in HTML output into rows
instead of separating them with a comma, so that it adds anchors to
secondary arguments. The rendered manpage already splits arguments into
multiple rows if there are multiple arguments for a specific command.

Fix CSS of the rtd_theme_violet theme and hide empty argument values.
2020-12-01 20:14:23 +01:00
bastimeyer 9a961f6ddc plugin: implement global plugin arguments
- Add `is_global` parameter to `streamlink.options.Argument`
  Global plugin arguments reference Streamlink's global arguments by
  name and cannot receive any other parameters, like `required`, etc.
- In `streamlink_cli.main.setup_plugin_args`, find the global argument
  references of each plugin, set the available default values and add
  the plugin to the argument's `plugins` list, which will be read by
  the docs generator
- In `streamlink_cli.main.setup_plugin_options`, set the provided
  global argument values on the plugin's `options` dictionary
- Refactor docs/ext_argparse
  - Don't override argparse.ArgumentParser when importing the parser
  - Add list of supported plugins to the parameter description if the
    `plugins` list is set on the argparse action object
- Add/improve/fix tests
2020-11-14 08:54:28 +01:00
bastimeyer 349b820835 docs: fix multiple options on the same line 2020-03-27 16:28:14 -07:00
back-to 66409146e3
docs-CLI: Fix for sort and prog issue
Fix unsorted plugin commands on python <= 3.5
afa12b6d1e
also for streamlink -h

Fix `%(prog)s`
https://streamlink.github.io/latest/cli.html#player-options

Fix block at the end
https://streamlink.github.io/latest/cli.html#cmdoption-t
2018-07-26 21:33:59 +02:00
beardypig d7a27b31b0 Plugin Arguments API (#1638)
* plugins: PluginArguments API

Allow plugins to specify arguments within the Plugin class.
This makes it easier to add and test plugin specific arguments, as well
as enabling sideloaded plugins to support command line arguments.

* update docs build to work with the new plugin arguments

* fix argument name override for funimation and ustream

* add some more tests for options/arguments

* rebase with abweb plugin

* switch to RuntimeException for py2 compat

* fix bug where required arguments were not prompted

* bug fixes for option names in plugins, should match existing names

* restore "normal" exception messages

* missed a RecursionError -> RuntimeError

* updated the api slightly with better (I think) argument name

added some docs for the Argument and Arguments classes

* options/args: normalise option names to replace - with _, and ensure the defaults are set

* normalise the plugin module name, replacing _ with -

* style issues pointed out by @back-to

* plugin.btsports: update to use PluginArguments

* plugins.bbciplayer: add hd argument

* plugins.twitch: move --twitch-oauth-authenticate back to argparser

Moved the option back to argparser as it's a special case.

* test: fixed typo
2018-05-25 14:25:15 -07:00
Alexis Murzeau bb85b4e699 Fix sphinx warning on Directive class
Sphinx has deprecated sphinx.util.compat.Directive.
Use the class in docutils as recommended by Sphinx.

Sphinx warning was: /usr/lib/python3/dist-packages/sphinx/util/compat.py:40:
RemovedInSphinx17Warning: sphinx.util.compat.Directive is deprecated and will
be removed in Sphinx 1.7, please use docutils' instead.
  RemovedInSphinx17Warning)
2017-10-07 19:58:34 +02:00
bastimeyer 447bbd296d Improve CLI documentation 2017-05-30 14:57:30 +02:00
bastimeyer 6a018847fa docs: fix parameters being linked in code blocks
#896
2017-05-23 12:51:42 +02:00
beardypig 5deb3413a8 docs: tweaks to docs and docs build process
Minor tweaks to the docs. Fixed all the warnings and enabled "Fail on warning" option so that problems with the docs will cause the build to fail on warning, the docs are also built for every commit and PR.
Restructured the travis script/after_success so that the docs are only pushed if the build was successful (only master branch and no PRs).
2017-01-16 11:52:14 +00:00
Christopher Rosell d8b2924379 docs: Rename argarse_ext to ext_argparse. 2014-07-20 11:53:05 +02:00