Skip to content
This repository has been archived by the owner on Oct 9, 2024. It is now read-only.

Add --version flag for ansible-language-server #392

Merged
merged 2 commits into from
Jul 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion bin/ansible-language-server
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
#!/usr/bin/env node

require("../out/server/src/server.js");
if (process.argv.includes("--version")) {
const pkgJSON = require("../package.json");
console.log(`${pkgJSON["version"]}`);
} else {
require("../out/server/src/server.js");
}
17 changes: 17 additions & 0 deletions test/utils/runCommand.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,26 @@ import { AssertionError, expect } from "chai";
import { WorkspaceManager } from "../../src/services/workspaceManager";
import { createConnection } from "vscode-languageserver/node";
import { getDoc } from "../helper";
import * as path from "path";

describe("commandRunner", () => {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const pkgJSON = require(path.resolve(__dirname, "..", "..", "package.json"));

const tests = [
{
args: [
path.join(
path.resolve(__dirname, "..", ".."),
"bin",
"ansible-language-server"
),
"--version",
],
rc: 0,
stdout: `${pkgJSON["version"]}`,
stderr: "",
},
{
args: ["ansible-config", "dump"],
rc: 0,
Expand Down