All files / commands helpers.ts

100% Statements 15/15
100% Branches 6/6
100% Functions 3/3
100% Lines 12/12

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25    4x 24x 24x 1x     4x 24x 24x 1x     4x 2x           2x 1x    
import { Uri, window } from "vscode";
 
export const createCommandTitle = (title: string): string => {
  const prepend = "Hack4Impact: ";
  if (title.indexOf(prepend) !== 0) return `${prepend}${title}`;
  return title;
};
 
export const createCommandName = (cmdName: string): string => {
  const prepend = "hack4impact.";
  if (cmdName.indexOf(prepend) !== 0) return `${prepend}${cmdName}`;
  return cmdName;
};
 
export const getSingleFolder = async (): Promise<Uri | undefined> => {
  const folderResult = await window.showOpenDialog({
    canSelectFiles: false,
    canSelectFolders: true,
    canSelectMany: false,
  });
 
  if (folderResult) return folderResult[0];
  return undefined;
};