Skip to content

Add --dry-run option to list referenced views #87

@stevehansen

Description

@stevehansen

Summary

Add a --dry-run (-dr) CLI option that lists all recursively referenced views and exits without performing any inlining. Useful for understanding the view dependency tree before committing to an inline operation.

Expected behavior

sqlinliner -cs "Server=.;Database=Test;Integrated Security=true" -vn "dbo.VHeavy" --dry-run

Should output the fully qualified names of all referenced views (recursively), then exit.

Implementation notes

From the previous attempt (PR #74, branch codex/add-dry-run-option-for-referenced-views):

  • Add a static DatabaseView.GetReferencedViews(DatabaseConnection, string viewSql) method that recursively resolves all nested views into a Dictionary<string, DatabaseView>
  • Add --dry-run / -dr option to Program.cs (using the new System.CommandLine 2.0.3 API)
  • When --dry-run is set, call GetReferencedViews, print each view name, and return early

The previous branch is stale and won't merge due to the System.CommandLine 2.0.3 migration and test suite changes on main.

Supersedes PR #74.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions