greybull 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +10 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -94,7 +94,7 @@ var ApiError = class extends Error {
94
94
  this.status = status;
95
95
  }
96
96
  };
97
- var VERSION = "0.2.1";
97
+ var VERSION = "0.2.2";
98
98
  function buildRequest(opts) {
99
99
  const url = new URL(opts.apiUrl.replace(/\/+$/, "") + opts.path);
100
100
  if (opts.query) {
@@ -527,13 +527,20 @@ async function prompt(question, valid, def, nonTtyDefault = def) {
527
527
  rl.close();
528
528
  }
529
529
  }
530
+ function editorArgv(cmd, args, file) {
531
+ const base = path2.basename(cmd).replace(/\.exe$/i, "").toLowerCase();
532
+ if (["vim", "nvim", "gvim", "mvim"].includes(base)) {
533
+ return [...args, "-c", "syntax enable", "-c", "set ft=bindzone", file];
534
+ }
535
+ return [...args, file];
536
+ }
530
537
  function openInEditor(zone, content) {
531
538
  const file = path2.join(os3.tmpdir(), `greybull-${zone}-${process.pid}.zone`);
532
539
  fs2.writeFileSync(file, content);
533
540
  const editor = process.env.VISUAL || process.env.EDITOR || (process.platform === "win32" ? "notepad" : "vi");
534
541
  const [cmd, ...args] = editor.split(" ");
535
542
  try {
536
- const r = spawnSync(cmd, [...args, file], { stdio: "inherit" });
543
+ const r = spawnSync(cmd, editorArgv(cmd, args, file), { stdio: "inherit" });
537
544
  if (r.error) return null;
538
545
  return fs2.readFileSync(file, "utf8");
539
546
  } finally {
@@ -667,7 +674,7 @@ async function domainsCheckCmd(ctx2, query, opts) {
667
674
 
668
675
  // src/index.ts
669
676
  var program = new Command();
670
- program.name("greybull").description("Manage Greybull DNS records and domains from the command line").version("0.2.1").option("--json", "output raw JSON", false).option("--api-url <url>", "portal base URL (or set GREYBULL_API_URL)");
677
+ program.name("greybull").description("Manage Greybull DNS records and domains from the command line").version("0.2.2").option("--json", "output raw JSON", false).option("--api-url <url>", "portal base URL (or set GREYBULL_API_URL)");
671
678
  function ctx(requireAuth = true) {
672
679
  const opts = program.opts();
673
680
  const apiUrl = resolveApiUrl(opts.apiUrl);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "greybull",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Command-line tool for the Greybull portal — manage DNS records and domains",
5
5
  "type": "module",
6
6
  "bin": {