Skip to content

Commit 0573a2c

Browse files
Merge pull request #126 from meshcloud/feature/deno-fmt
style: run deno fmt on cli
2 parents bf957c0 + 65b57ff commit 0573a2c

28 files changed

+584
-322
lines changed

cli/unipipe/blueprints/basic-handler.js.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { uuid } from '../deps.ts';
1+
import { uuid } from "../deps.ts";
22

33
export const basicTransformHandler = `
44
/**
@@ -45,4 +45,4 @@ const handlers = {
4545
};
4646
4747
handlers;
48-
`
48+
`;

cli/unipipe/blueprints/catalog.yml.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import { uuid } from '../deps.ts';
1+
import { uuid } from "../deps.ts";
22

3-
export const catalog =
4-
`services:
3+
export const catalog = `services:
54
# define a simple service offering
65
# for field documentation see https://github.com/openservicebrokerapi/servicebroker/blob/v2.15/spec.md#service-offering-object
76
- id: ${uuid.generate()} # this uuid was randomly generated using "unipipe generate uuid"

cli/unipipe/blueprints/execution-script.sh.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ for filepath in **/*.main.tf; do
2929
fi
3030
echo "----------------------------------------------------------------"
3131
done
32-
`
32+
`;

cli/unipipe/blueprints/github-workflow.yml.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,4 @@ jobs:
4343
git add .
4444
git diff-index --quiet HEAD || git commit -m "Updating Examples"
4545
git push
46-
`
46+
`;

cli/unipipe/blueprints/terraform-handler.js.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { uuid } from '../deps.ts';
1+
import { uuid } from "../deps.ts";
22

33
export const terraformTransformHandler = `
44
/**
@@ -116,4 +116,4 @@ const handlers = {
116116
};
117117
118118
handlers;
119-
`
119+
`;

cli/unipipe/blueprints/terraform-runner-hello-world-service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,4 +154,4 @@ terraform.tfstate
154154
# The deployment folder may contain secrets
155155
terraform/deployment/terraform.tfstate
156156
terraform/deployment/env.sh
157-
`
157+
`;

cli/unipipe/blueprints/unipipe-osb-aci.tf.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,4 @@ output "unipipe_git_ssh_key" {
5757
output "info" {
5858
value = "UniPipe OSB is starting now. This may take a couple of minutes on Azure ACI. You can use Azure Portal to view logs of the container starting up and debug any issues. Also note that for newly deployed domains Azure ACI can take a few minutes to provide DNS."
5959
}
60-
`
60+
`;

cli/unipipe/blueprints/unipipe-osb-gcloud-cloudrun.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,4 @@ output "unipipe_git_ssh_key" {
6060
value = module.unipipe.unipipe_git_ssh_key
6161
description = "UniPipe will use this key to access the git repository. You have to give read+write access on the target repository for this key."
6262
}
63-
`
63+
`;

cli/unipipe/commands/browse.ts

Lines changed: 42 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
import { colors, Command, Input, List, prompt, Select, SelectValueOptions } from "../deps.ts";
1+
import {
2+
colors,
3+
Command,
4+
Input,
5+
List,
6+
prompt,
7+
Select,
8+
SelectValueOptions,
9+
} from "../deps.ts";
210
import { OsbStatusValue } from "../osb.ts";
311
import { Repository } from "../repository.ts";
412
import { stringify } from "../yaml.ts";
@@ -9,7 +17,7 @@ export function registerBrowseCmd(program: Command) {
917
program
1018
.command("browse [repo]")
1119
.description("Interactively browse and manipulate a UniPipe OSB git repo.")
12-
.action(async (_opts: Record<never, never>, repo: string|undefined) => {
20+
.action(async (_opts: Record<never, never>, repo: string | undefined) => {
1321
const repository = new Repository(repo ? repo : ".");
1422
await browseInstances(repository);
1523
});
@@ -32,19 +40,23 @@ async function browseInstances(repo: Repository) {
3240
colors.dim("service: ") + colors.green(i.serviceDefinition.name),
3341
colors.dim("plan: ") + colors.yellow(plan.name),
3442
colors.dim("bindings: ") +
35-
colors.brightMagenta(x.bindings.length.toString()),
43+
colors.brightMagenta(x.bindings.length.toString()),
3644
colors.dim("status: ") +
37-
colors.blue(x.status?.status || "new") +
38-
colors.red(i.deleted ? " deleted" : ""),
45+
colors.blue(x.status?.status || "new") +
46+
colors.red(i.deleted ? " deleted" : ""),
3947
];
4048

4149
// In contrast to the list command, we do not require user input for determining which profile to use.
4250
if (i.context.platform === "meshmarketplace") {
43-
instanceDetails.unshift(colors.dim("project: ") + colors.white(i.context.project_id))
44-
instanceDetails.unshift(colors.dim("customer: ") + colors.white(i.context.customer_id))
51+
instanceDetails.unshift(
52+
colors.dim("project: ") + colors.white(i.context.project_id),
53+
);
54+
instanceDetails.unshift(
55+
colors.dim("customer: ") + colors.white(i.context.customer_id),
56+
);
4557
}
4658

47-
const name = instanceDetails.join(" ")
59+
const name = instanceDetails.join(" ");
4860

4961
return { name, value: i.serviceInstanceId };
5062
});
@@ -61,10 +73,10 @@ async function browseInstances(repo: Repository) {
6173
colors.dim("id: ") + colors.gray(x.binding.bindingId),
6274
// we could add binding parameters in here,
6375
colors.dim("params: ") +
64-
colors.green(JSON.stringify(x.binding.parameters)),
76+
colors.green(JSON.stringify(x.binding.parameters)),
6577
colors.dim("status: ") +
66-
colors.blue(x.status?.status || "new") +
67-
colors.red(x.deleted ? " deleted" : ""),
78+
colors.blue(x.status?.status || "new") +
79+
colors.red(x.deleted ? " deleted" : ""),
6880
].join(" ");
6981

7082
return { name, value: x.binding.bindingId };
@@ -83,7 +95,7 @@ async function browseInstances(repo: Repository) {
8395
message: "Pick a service instance",
8496
options: instanceOptions,
8597
search: true,
86-
info: true
98+
info: true,
8799
},
88100
{
89101
name: "instanceCmd",
@@ -102,9 +114,8 @@ async function browseInstances(repo: Repository) {
102114
await refreshBindingList(instanceId);
103115
if (bindingOptions.length > 0) {
104116
next("selectBinding");
105-
}
106-
else {
107-
console.log("No bindings found for this instance!")
117+
} else {
118+
console.log("No bindings found for this instance!");
108119
next("instanceCmd");
109120
}
110121
break;
@@ -127,7 +138,7 @@ async function browseInstances(repo: Repository) {
127138
message: "Pick a service binding",
128139
options: bindingOptions,
129140
search: true,
130-
info: true
141+
info: true,
131142
},
132143
{
133144
name: "bindingCmd",
@@ -198,7 +209,7 @@ async function updateInstance(repo: Repository, instanceId: string) {
198209
async function updateBinding(
199210
repo: Repository,
200211
instanceId: string,
201-
bindingId: string
212+
bindingId: string,
202213
) {
203214
const { status, description } = await prompt([
204215
{
@@ -215,8 +226,9 @@ async function updateBinding(
215226
]);
216227
const credentials: string[] = await List.prompt(
217228
{
218-
message: "Add credential `key:value` pairs. Use comma `,` to separate credentials. If you don't want to update, leave it blank.",
219-
}
229+
message:
230+
"Add credential `key:value` pairs. Use comma `,` to separate credentials. If you don't want to update, leave it blank.",
231+
},
220232
);
221233

222234
// cliffy does not support whitespace in list prompt input.
@@ -225,12 +237,15 @@ async function updateBinding(
225237
credentials.forEach((credential) => {
226238
const colonIndex = credential.indexOf(":");
227239
if (colonIndex === -1) {
228-
throw new Error("Could not find colon `:` in credential `key:value` pair: " + credential);
240+
throw new Error(
241+
"Could not find colon `:` in credential `key:value` pair: " +
242+
credential,
243+
);
229244
}
230245
const key = credential.substring(0, colonIndex);
231246
const value = credential.substring(colonIndex + 1);
232247
fixedCredentials.push(key + ": " + value);
233-
})
248+
});
234249

235250
await update(repo, {
236251
instanceId,
@@ -241,18 +256,20 @@ async function updateBinding(
241256
});
242257

243258
console.log(
244-
`Updated status of instance ${instanceId} binding ${bindingId} to '${status}' and credentials are '${fixedCredentials.length > 0 ? 'overwritten' : 'not updated'}'`
259+
`Updated status of instance ${instanceId} binding ${bindingId} to '${status}' and credentials are '${
260+
fixedCredentials.length > 0 ? "overwritten" : "not updated"
261+
}'`,
245262
);
246263
}
247264

248265
async function showBinding(
249266
repo: Repository,
250267
instanceId: string,
251-
bindingId: string
268+
bindingId: string,
252269
) {
253270
const instance = await repo.loadInstance(instanceId);
254271
const binding = instance.bindings.find(
255-
(x) => x.binding.bindingId === bindingId
272+
(x) => x.binding.bindingId === bindingId,
256273
);
257274

258275
if (!binding) {
@@ -262,4 +279,4 @@ async function showBinding(
262279
// todo: also consider printing the file paths for any "show" style command?
263280
const p = { indent: 4 };
264281
console.log(stringify(binding, p));
265-
}
282+
}

0 commit comments

Comments
 (0)