File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2626@click .group ()
2727@click .version_option (package_name = "deploydiff" )
2828@click .option ("--no-gate" , is_flag = True , help = "Skip license gating check." )
29+ @click .option (
30+ "--require-license" ,
31+ is_flag = True ,
32+ envvar = "REVENUEHOLDINGS_REQUIRE_LICENSE" ,
33+ help = (
34+ "Exit with an error if revenueholdings-license is not installed "
35+ "or if the license check fails. "
36+ "Also enabled via REVENUEHOLDINGS_REQUIRE_LICENSE=1."
37+ ),
38+ )
2939@click .pass_context
30- def main (ctx , no_gate ) -> None :
40+ def main (ctx , no_gate , require_license ) -> None :
3141 """DeployDiff - Preview infrastructure changes with cost impact and rollback."""
3242 ctx .ensure_object (dict )
3343 ctx .obj ["no_gate" ] = no_gate
34- if _HAS_RH_LICENSE and not no_gate :
35- require_license ("deploydiff" )
44+ ctx .obj ["require_license" ] = require_license
45+ if not no_gate :
46+ if _HAS_RH_LICENSE :
47+ from revenueholdings_license import require_license as _rl
48+ _rl ("deploydiff" )
49+ elif require_license :
50+ console .print (
51+ "[bold red]Error:[/bold red] revenueholdings-license is not installed. "
52+ "Install it with: pip install revenueholdings-license"
53+ )
54+ raise SystemExit (1 )
3655
3756
3857@main .command ()
You can’t perform that action at this time.
0 commit comments