Conversation
tabcmd Classic invokes delete as `tabcmd delete --workbook "Name"` where --workbook takes the target name as its value. tabcmd 2 shipped `tabcmd delete "Name" --workbook` (name positional, flag is a type selector). This is a breaking CLI difference for anyone running Classic scripts unchanged. Accept both forms: - Positional name stays optional (nargs="?"). - --workbook/--datasource take an optional value (nargs="?"). Bare form still means True (tabcmd 2 syntax); with a value, the value is the target name (Classic syntax). - In run_command, resolve which form supplied the name and normalize args.workbook/args.datasource to True. Emit the same "requires workbook or datasource" error when neither form supplied a name. Mutual exclusion between --workbook and --datasource still holds. Fixes #433.
Covers gaps flagged in fresh-eyes review: - `-w` / `-d` short flags on Classic form - Ambiguous "positional Name + --workbook FlagValue" -- parser accepts both; run_command normalization discards flag value - Bare `--workbook` with no value (parses because nargs="?" const=True) - Classic form + -r project combined The run_command normalization itself (`isinstance(args.workbook, str) -> args.name = args.workbook; args.workbook = True`) is not covered here; tracked in the follow-up run_command coverage issue. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
Validate missing targets before creating a session to avoid unnecessary connection attempts.
Review effort: Lite
Findings: None
What changed in this PR
Adds Classic-compatible delete --workbook NAME and --datasource NAME syntax while preserving positional syntax.
Changes:
- Supports optional target names and flag values.
- Normalizes Classic and tabcmd 2 argument forms.
- Adds parser coverage for supported combinations.
| File | Description |
|---|---|
tests/parsers/test_parser_delete.py |
Tests Classic and positional delete syntax. |
tabcmd/execution/global_options.py |
Allows optional values on target-type flags. |
tabcmd/commands/datasources_and_workbooks/delete_command.py |
Resolves and normalizes target arguments. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #433.
Motivation
tabcmd Classic invokes delete as
tabcmd delete --workbook "Name"where
--workbookcarries the target name as its value. tabcmd 2shipped
tabcmd delete "Name" --workbook(name positional, flag astype selector). This is a breaking CLI difference for anyone running
Classic scripts against tabcmd 2. Verified against Classic 2025.1 on
main-windows.tsi.lan.
Behavior change
For users: both forms now work.
nameis now optional (nargs="?").--workbook/--datasourcetake an optional value (nargs="?").Bare form still means
True(tabcmd 2 syntax); with a value, thevalue is the target name (Classic syntax).
run_commandresolves which form supplied the name and normalizesargs.workbook/args.datasourcetoTrue.--workbookand--datasourcestill holds.tabcmd delete Name --workbook OtherName), the positional wins and the flagvalue is silently discarded. Not ideal; could be tightened to an
explicit error in a follow-up.
Test plan
tests/parsers/test_parser_delete.py— 11 tests covering: bothforms, short flags (
-w/-d), mutual exclusion, empty parse,positional+flag-value conflict, bare
--workbookwith no value,Classic form combined with
-rproject flagdisposable workbooks, deleted via all three combinations (tabcmd 2
form, tabcmd 2 with Classic-form flag, Classic 2025.1), same outcome
run_commandnormalization not covered here; tracked in Test coverage gap: run_command logic in the recent parity sweep is untested #457🤖 Generated with Claude Code
Source
Classic tabcmd docs: https://help.tableau.com/current/server-linux/en-us/tabcmd_cmd.htm#delete documents both forms — positional
tabcmd delete "Sales_Analysis"and flag-valuetabcmd delete --workbook "name" --project "projectname". The Windows-tsi live-verification against Classic 2025.1 (noted in Motivation) covers the positional+flag-value conflict case on top of the baseline "both forms exist" claim.