From e1f0c5ad49611532531aafdb04a1aaecb85133a5 Mon Sep 17 00:00:00 2001 From: edabor <117822458+edabor@users.noreply.github.com> Date: Mon, 3 Nov 2025 13:01:07 +0100 Subject: [PATCH] docs(started): add custom cli note --- docs/vitepress/guide/intro/getting_started.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/vitepress/guide/intro/getting_started.md b/docs/vitepress/guide/intro/getting_started.md index 29e3968b..7a635de5 100644 --- a/docs/vitepress/guide/intro/getting_started.md +++ b/docs/vitepress/guide/intro/getting_started.md @@ -197,10 +197,17 @@ from trame.app import get_server server = get_server() server.cli.add_argument("-d", "--data", help="Directory to explore", dest="data") -args = server.cli.parse_args() +args = server.cli.parse_known_args()[0] print(args.data) ``` +Note that if you intend to use your own CLI parser or rely on a library which parses CLI arguments, +you need to make sure that the arguments are not overlapping with the trame server ones. +In case of CLI arguments overlapping and still requiring to pass arguments to trame server's, it is +recommended to use either the `--trame-args` flag (eg. `--trame-args="-p 1000"`) or the `TRAME_ARGS` environment variable, +which have a higher priority over CLI arguments. + + ## Starting an application The server provides a `start()` method which actually starts a trame application. Typically the following section is placed in the main script: