Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add raw command, a new module for common CLI options, and improve matrix raw help #129

Merged
merged 6 commits into from
Oct 14, 2023

Conversation

JOJ0
Copy link
Owner

@JOJ0 JOJ0 commented Oct 2, 2023

Addressing 2 things:

  • A new subcommand synadm raw that should, very similar to what we have insynadm matrix raw, be able to rudimentary issue custom requests (that don't have their own synadm commmand yet).
  • Finally provide a way to a common problem in the synadm project: Often it's desired to share options or groups of options with multiple commands, even when they are in different "main commands" (live in different modules).
    • Introducing a new module synadm.cli._common containing such options and option groups.
    • The new raw command will make use of it.
  • Fixes Add ability to call custom GET/POST command via synadm script #11

@JOJ0 JOJ0 force-pushed the raw_cmd_and_common_opts branch from e64892b to 530782a Compare October 2, 2023 10:19
JOJ0 added 2 commits October 13, 2023 10:03
- Create a new module synadm.cli._module holding command options and
  option groups supposed to be shared between commands.
- Move some of groups and options of matrix-raw command into the new
  module since.
@JOJ0 JOJ0 force-pushed the raw_cmd_and_common_opts branch from 1f5cb6d to c02db9e Compare October 13, 2023 08:03
- New cli-level module "raw" containing "raw" command directly (without
  a group)
- Copy boilerplate from "matrix raw" command - almost the same but still
  a little different - actually even simpler.
- Import and use shared options from cli._common.
- for `synadm raw --help` state the fact that URL encoding needs to be handled at this
  point already; add an example that includes an encoded URL for maximum
  clarity; and suggest the usage of the global verbose flag.
@JOJ0 JOJ0 force-pushed the raw_cmd_and_common_opts branch from c02db9e to 8d92852 Compare October 13, 2023 08:04
@JOJ0 JOJ0 marked this pull request as ready for review October 13, 2023 08:08
@JOJ0 JOJ0 marked this pull request as draft October 13, 2023 08:12
@JOJ0 JOJ0 force-pushed the raw_cmd_and_common_opts branch from bf9db72 to aefbb13 Compare October 13, 2023 09:54
JOJ0 added 3 commits October 13, 2023 12:01
- Use proper rst syntax for stating commands/cli/monospaced (double
  backticks), which improves rendered docs and still looks good enough
  in --help on the shell.
- Clarify which config settings we are referring to.
- Format token precedence list with \b (displays linebreaks as-is;
  renders nicely on the shell as well as in the Sphinx docs.
- Add an "insecure warning"
@JOJ0 JOJ0 force-pushed the raw_cmd_and_common_opts branch from aefbb13 to 6e52699 Compare October 13, 2023 10:14
@JOJ0 JOJ0 marked this pull request as ready for review October 13, 2023 10:16
@JOJ0
Copy link
Owner Author

JOJ0 commented Oct 13, 2023

Thanks for a quick review. Not so much about the technicalities, but about the many fixes/clarifications/format-improvements I tried to squeeze into --help of both, the existing matrix raw, as well as the raw command.

I tested the feature and since it's a simpler version of matrix raw which is tried and tested there shouldn't be much to worry about. It's not a replacement for curl but a simple way of quickly issuing something to the Admin API synadm does not support yet. Even I see it as a quick helper for developing new synadm features, often without having to touch curl or handling tokens on the shell.

The behaviour of both raw commands is streamlined as good as possible as you will see when comparing their --help

@JOJ0 JOJ0 changed the title Add raw command and a new module for common CLI options Add raw command, a new module for common CLI options, and improve matrix raw help Oct 13, 2023
@JOJ0
Copy link
Owner Author

JOJ0 commented Oct 13, 2023

For maximum review convenience, here screenshots how rendered docs look like:

raw help:

Screenshot 2023-10-13 at 12 38 20

matrix raw help part 1:

Screenshot 2023-10-13 at 12 35 37

matrix raw help part 2:

Screenshot 2023-10-13 at 12 35 54

@JOJ0 JOJ0 merged commit 7da00fa into master Oct 14, 2023
@JOJ0
Copy link
Owner Author

JOJ0 commented Oct 14, 2023

@JacksonChen666 I decided that this is most probably good and spare you the testing/reviewing. I think it's fine and blast radius is narrow. Let's get it out there. I'll even release it shortly....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add ability to call custom GET/POST command via synadm script
1 participant