Skip to content

Commit

Permalink
Merge pull request #5 from gsipos/add-whitespace-between-menus
Browse files Browse the repository at this point in the history
add whitespace between menus
  • Loading branch information
gsipos authored Apr 16, 2018
2 parents 7e15720 + e0bebba commit 38ca44b
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/menu/choose-task.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Project } from "../model";
import inquirer from "inquirer";
import { showTaskMenu } from "./task";
import { addMenuSeparator } from "./utils";

const chooseTaskMenu: inquirer.Question = {
type: 'list',
Expand All @@ -9,6 +10,7 @@ const chooseTaskMenu: inquirer.Question = {
};

export async function chooseTask(project: Project) {
addMenuSeparator();
const choices = project.tasks.map(t => ({
name: t.code + ' ' + t.name,
value: t
Expand Down
2 changes: 2 additions & 0 deletions src/menu/create-project.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import inquirer from "inquirer";
import { Project, confidenceIntervals } from "../model";
import { showProjectMenu } from "./project";
import { addMenuSeparator } from "./utils";

interface ProjectInit {
name: string;
Expand Down Expand Up @@ -39,6 +40,7 @@ const createProject: inquirer.Question<ProjectInit>[] = [
];

export async function createProjectMenu() {
addMenuSeparator();
const { name, short, defaultInterval } = await inquirer.prompt(createProject);
const project: Project = {
name,
Expand Down
2 changes: 2 additions & 0 deletions src/menu/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { listTags } from "./list-tags";
import { saveProjectToFile } from "../files";
import { chooseProjectMenu } from "./choose-project";
import { chooseTask } from "./choose-task";
import { addMenuSeparator } from "./utils";

enum ProjectMenuEntry {
ADD_TASK = "Add task",
Expand Down Expand Up @@ -69,6 +70,7 @@ function executeOnChoice(
}

export async function showProjectMenu(project: Project) {
addMenuSeparator();
const answer = await inquirer.prompt(ProjectMenu);

executeOnChoice(ProjectMenuEntry.SHOW_PROJECT_SUMMARY, answer, () => {
Expand Down
2 changes: 2 additions & 0 deletions src/menu/task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import inquirer from "inquirer";
import { internals } from "rx";
import { estimateFromString } from "./add-task";
import { listTasks } from "./list-tasks";
import { addMenuSeparator } from "./utils";

const choices = [
"Change task name",
Expand All @@ -19,6 +20,7 @@ const taskMenu: inquirer.Question = {
};

export async function showTaskMenu(project: Project, task: Task) {
addMenuSeparator();
listTasks([task]);
const answer = await inquirer.prompt(taskMenu);
const idx = choices.indexOf(answer.name);
Expand Down
10 changes: 10 additions & 0 deletions src/menu/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

export function addMenuSeparator() {
console.log("");
console.log("----------------------------------");
console.log("");
}

export function addSimpleSeparator() {
console.log("");
}

0 comments on commit 38ca44b

Please sign in to comment.