Skip to content

Commit 053dbe7

Browse files
monyarmPetarKirov
authored andcommitted
feat(commands/deploy_spec): Enhance deploy_spec command with argparse integration and structured argument handling
1 parent 0e316b1 commit 053dbe7

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

packages/mcl/src/main.d

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ template genSubCommandArgs()
3030
"@SubCommands\n"~
3131
"SumType!("~
3232
"get_fstab_args,"~
33+
"deploy_spec_args,"~
3334
"Default!unknown_command_args"~
3435
") cmd;";
3536
}

packages/mcl/src/src/mcl/commands/deploy_spec.d

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import std.logger : infof, warningf;
55
import std.file : exists;
66
import std.path : buildPath;
77

8+
import argparse;
9+
810
import mcl.utils.process : spawnProcessInline;
911
import mcl.utils.path : resultDir;
1012
import mcl.utils.cachix : cachixNixStoreUrl, DeploySpec, createMachineDeploySpec;
@@ -13,7 +15,12 @@ import mcl.utils.json : tryDeserializeFromJsonFile, writeJsonFile;
1315

1416
import mcl.commands.ci_matrix : flakeAttr, params, nixEvalJobs, SupportedSystem;
1517

16-
export void deploy_spec(string[] args)
18+
19+
@(Command("deploy-spec").Description("Evaluate the Nixos machine configurations in bareMetalMachines and deploy them to cachix."))
20+
export struct deploy_spec_args {
21+
}
22+
23+
export int deploy_spec(deploy_spec_args args)
1724
{
1825
const deploySpecFile = resultDir.buildPath("cachix-deploy-spec.json");
1926

@@ -56,4 +63,6 @@ export void deploy_spec(string[] args)
5663
spawnProcessInline([
5764
"cachix", "deploy", "activate", deploySpecFile, "--async"
5865
]);
66+
67+
return 0;
5968
}

packages/mcl/src/src/mcl/commands/package.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module mcl.commands;
22

33
public import mcl.commands.get_fstab : get_fstab, get_fstab_args;
4-
public import mcl.commands.deploy_spec : deploy_spec;
4+
public import mcl.commands.deploy_spec : deploy_spec, deploy_spec_args;
55
public import mcl.commands.ci_matrix : ci_matrix, print_table;
66
public import mcl.commands.shard_matrix : shard_matrix;
77
public import mcl.commands.ci : ci;

0 commit comments

Comments
 (0)