Skip to content

Scan -p . ignores the explicit path and prompts for one; in a script (no stdin) it prints "No path provided. Aborting." and scans nothing #181

Description

@matt-edmondson

What's wrong

BaseVerb.PathString defaults to "." (BaseVerb.cs:15). Scan.ValidateArgs decides whether to prompt by checking if (PathString is "." or "") (Scan.cs:23). That check can't tell "no -p given" apart from an explicit -p ., so the user's argument is thrown away.

Repro

cd ~/pics
ImageDescriber Scan -p . < /dev/null
# Enter the path to scan: No path provided. Aborting.

ImageDescriber Scan -p ./ and -p "$PWD" scan normally.

Why it matters

cd dir && ImageDescriber Scan -p . is the most natural way to run a scan from a script, cron job or scheduled task. It silently does nothing (see also #167, which covers the exit code being 0 even then). Run interactively, it re-asks for a path the user has just given.

Suggested fix

  • Default PathString to string.Empty (or make it string?), and prompt only when it is empty.
  • Update the reset at Scan.cs:158 (PathString = ".") to match, so the menu still prompts on its next Scan.
  • Check that other users of Path still get the current directory when nothing is given.
  • Add a test that Scan with PathString = "." set explicitly does not prompt.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions