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

Commit

Permalink
Add --version flag for ansible-language-server (#392)
Browse files Browse the repository at this point in the history
* feat: add --version flag for ansible-language-server

* chore: add test for --version flag in ALS
  • Loading branch information
yaegassy authored Jul 1, 2022
1 parent cae75dd commit a002593
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
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

0 comments on commit a002593

Please sign in to comment.