Skip to content

Commit

Permalink
fix: rename aoc data to aoc input to clarify
Browse files Browse the repository at this point in the history
  • Loading branch information
nobkd committed Dec 3, 2022
1 parent 6bcb941 commit 95e2544
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 25 deletions.
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
"onCommand:advent-of-vscode.loadCookie",
"onCommand:advent-of-vscode.openDescriptionPanel",
"onCommand:advent-of-vscode.select",
"onCommand:advent-of-vscode.saveData",
"onCommand:advent-of-vscode.copyData",
"onCommand:advent-of-vscode.saveInput",
"onCommand:advent-of-vscode.openInputEditor",
"onCommand:advent-of-vscode.refreshDescription",
"onCommand:advent-of-vscode.refreshTree"
],
Expand Down Expand Up @@ -99,12 +99,12 @@
"group": "navigation@1"
},
{
"command": "advent-of-vscode.saveData",
"command": "advent-of-vscode.saveInput",
"when": "view == descriptionView && advent-of-vscode.loggedIn && advent-of-vscode.daySelected",
"group": "navigation@2"
},
{
"command": "advent-of-vscode.openDataEditor",
"command": "advent-of-vscode.openInputEditor",
"when": "view == descriptionView && advent-of-vscode.loggedIn && advent-of-vscode.daySelected",
"group": "navigation@3"
}
Expand All @@ -122,13 +122,13 @@
"icon": "$(log-out)"
},
{
"command": "advent-of-vscode.saveData",
"title": "Save AoC Data as File",
"command": "advent-of-vscode.saveInput",
"title": "Save AoC Input as File",
"icon": "$(save-as)"
},
{
"command": "advent-of-vscode.openDataEditor",
"title": "Open AoC Data to Editor",
"command": "advent-of-vscode.openInputEditor",
"title": "Open AoC Input to Editor",
"icon": "$(preferences-open-settings)"
},
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import * as vscode from 'vscode';

import { collectFetchData } from '../utils/helper';
import { collectFetchInput } from '../utils/helper';

export async function openDataEditor(context: vscode.ExtensionContext, year: number | undefined, day: number | undefined) {
const content = await collectFetchData(year, day);
export async function openInputEditor(context: vscode.ExtensionContext, year: number | undefined, day: number | undefined) {
const content = await collectFetchInput(year, day);
if (content === undefined) {
return;
}
Expand Down
6 changes: 3 additions & 3 deletions src/commands/saveData.ts → src/commands/saveInput.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import * as vscode from 'vscode';
import { TextEncoder } from 'util';

import { collectFetchData } from '../utils/helper';
import { collectFetchInput } from '../utils/helper';

export async function saveData(context: vscode.ExtensionContext, year: number | undefined, day: number | undefined): Promise<void> {
const data = await collectFetchData(year, day);
export async function saveInput(context: vscode.ExtensionContext, year: number | undefined, day: number | undefined): Promise<void> {
const data = await collectFetchInput(year, day);
if (data === undefined) {
return;
}
Expand Down
14 changes: 7 additions & 7 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import * as vscode from 'vscode';

import { login } from './commands/login';
import { logout } from './commands/logout';
import { saveData } from './commands/saveData';
import { openDataEditor } from './commands/openDataEditor';
import { saveInput } from './commands/saveInput';
import { openInputEditor } from './commands/openInputEditor';

import { SelectDayView } from './views/selectDayView';
import { DescriptionView } from './views/descriptionView';
Expand Down Expand Up @@ -99,16 +99,16 @@ export async function activate(context: vscode.ExtensionContext) {
)
);

// Data
// Input
context.subscriptions.push(
vscode.commands.registerCommand('advent-of-vscode.openDataEditor',
async (year: number | undefined, day: number | undefined) => openDataEditor(context, year ?? selectionProxy.year, day ?? selectionProxy.day)
vscode.commands.registerCommand('advent-of-vscode.openInputEditor',
async (year: number | undefined, day: number | undefined) => openInputEditor(context, year ?? selectionProxy.year, day ?? selectionProxy.day)
)
);

context.subscriptions.push(
vscode.commands.registerCommand('advent-of-vscode.saveData',
(year: number | undefined, day: number | undefined) => saveData(context, year ?? selectionProxy.year, day ?? selectionProxy.day) // TODO: change for inline cmds
vscode.commands.registerCommand('advent-of-vscode.saveInput',
(year: number | undefined, day: number | undefined) => saveInput(context, year ?? selectionProxy.year, day ?? selectionProxy.day) // TODO: change for inline cmds
)
);
}
Expand Down
6 changes: 3 additions & 3 deletions src/utils/helper.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as vscode from 'vscode';

import { fetchData } from './request';
import { fetchInput } from './request';
import { selectionProxy } from '../extension';

export function getNonce(): string {
Expand Down Expand Up @@ -44,10 +44,10 @@ export function getDefaultHtml(defaultData: any) {
`;
}

export function collectFetchData(year: number | undefined, day: number | undefined): Promise<string | undefined> {
export function collectFetchInput(year: number | undefined, day: number | undefined): Promise<string | undefined> {
if (selectionProxy.loggedIn === false) {
vscode.window.showErrorMessage('Please [log in](command:advent-of-vscode.login) before getting data');
}

return fetchData(year, day);
return fetchInput(year, day);
}
2 changes: 1 addition & 1 deletion src/utils/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export async function fetchDescription(year: number, day: number): Promise<strin
}


export async function fetchData(year: number | undefined, day: number | undefined): Promise<string | undefined> {
export async function fetchInput(year: number | undefined, day: number | undefined): Promise<string | undefined> {
if (year === undefined || day === undefined) {
return;
}
Expand Down

0 comments on commit 95e2544

Please sign in to comment.