tarantool / tarantool/tt

`tt run script.lua -- -h` arg parsing not as written in `--help`

Open
#1,213 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
113
Forks
18
Avg merge
4d 11h
Merged PRs (30d)
23

Description

tt version

Tarantool CLI version 2.11.0, linux/amd64. commit: a9d884f

tt run --help
Run Tarantool instance.
All command line arguments are passed to the interpreted SCRIPT. Options to process in the SCRIPT
are passed after '--'.

USAGE
  tt run [SCRIPT.lua [flags] [-- ARGS]]

FLAGS
  -h, --help   help for run

EXAMPLES
  
# Print current environment Tarantool version:

    $ tt run --version
    Tarantool 2.11.0-entrypoint-724-gd2d7f4de3
    . . .

# Run a script (which print passed arguments) with 3 arguments and 2 options:

    $ tt run script.lua a b c -- -a -b
    a b c -a -b

# Run a script, pass '-i' argument to it, and enter interactive mode after script execution:

    $ tt run -i script.lua -- -i
    -i
    Tarantool 2.11.0-entrypoint-724-gd2d7f4de3
    type 'help' for interactive help
    tarantool>

First '-i' option is parsed by 'tt run' and means 'enter interactive mode'. The second '-i'
is after '--', so passed to script.lua as is.

# Execute stdin:

    $ echo 'print(42)' | tt run -
    42
-- script.lua
print(table.concat(arg, ","))
tt run script.lua a b c -- -a -b # a,b,c,--,-a,-b
tt run -i script.lua -- -i
# --,-i
# Tarantool 3.5.0-0-g81b5335
# type 'help' for interactive help
# tarantool> 
# Can't pass `-h` flag to script (catched by tt)
tt run script.lua -- -h # tt run --help

Was broken in 2.1.1 https://github.com/tarantool/tt/commit/744a4c733d7affe3c573b15f55a20bb5731a9ed3

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the documented and failing tt run commands from the issue, especially tt run script.lua -- -h, and compare the arguments received by the Lua script. Trace the tt run argument-parsing entry point and add regression coverage showing that arguments after -- reach the script unchanged; done means the documented examples produce the stated results.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, lua
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.