Skip to content

Channel argument treated as path #1043

@MichaelXavier

Description

@MichaelXavier

Description
The CLI documentation indicates that the first argument should be a channel name and the second a directory. However, if you have a channel name that happens to have the same name as a subdir of the current directory, tv will go against the documentation and treat the first argument as a dir, then it will run the default command, typically files

Example
I have the following channel for npins

# npins.toml
[metadata]
description = "A channel to select npins pins for update, freeze, or unfreeze"
name = "npins"
requirements = ["npins", "jq"]

[preview]
command = "jq '.pins[\"{}\"]' npins/sources.json"

[source]
command = "jq -r '.pins | keys[]' npins/sources.json"

When I run tv npins in my project root with an npins subdir, it selects the files channel and shows me the files in npins

Expected behavior
I would expect it would select the npins channel with no directory argument.

Environment

  • OS: NixOS
  • TV version: 0.15.4
  • shell: fish
  • terminal: wezterm
# config.toml
[ui]
theme = "catppuccin-mocha-mauve"
use_nerd_font_icons = true

Additional context
This is likely a regression introduced in e76a3df in cli/mod.rs. Previously it checked for the existence of a channel but that logic got flipped and it now checks if the first argument is a directory and only falls back to treating it as a channel if it isn't.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions