Skip to content

fix(cli): Add missing if __name__ == '__main__' block and return non-zero exit code on invalid path #26

Description

@CodeMaverick-143

Problem Description

  1. In insight/cli.py, def main() is defined, but there is no if __name__ == "__main__": main() block. If a user runs python -m insight.cli or executes python path/to/insight/cli.py, the script exits silently without executing main().
  2. When the specified target path does not exist, cli.py prints an error message but executes return, which exits with returncode 0. This causes automated scripts and CI pipelines to interpret the failed run as a success.

Affected Files

  • insight/cli.py:26-38

Proposed Solution

  1. Add if __name__ == "__main__": main() at the end of insight/cli.py.
  2. Replace return with sys.exit(1) when not os.path.exists(args.path).

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 workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions