Skip to content
Open
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
27 changes: 27 additions & 0 deletions drplr.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const { handleUploadCommand } = require('./lib/commands/upload');
const { handleLinkCommand } = require('./lib/commands/link');
const { handleNoteCommand } = require('./lib/commands/note');
const { handleAuthCommand } = require('./lib/commands/auth');
const { handleBoardCommand, handleBoardsCommand } = require('./lib/commands/board');
const { executeCommand } = require('./lib/command-utils');
const logger = require('./lib/logger');

Expand All @@ -18,6 +19,12 @@ Usage:
drplr note <text> Create a text note
drplr note --file <file> Create note from file
drplr note --code <code> --lang <lang> Create code snippet
drplr boards List all boards
drplr board create <title> Create a new board
drplr board <board_id> Show board contents
drplr board update <id> --title <name> Update board
drplr board delete <board_id> Delete a board
drplr board watch <board_id> Subscribe to board notifications
drplr auth token <jwt_token> Set JWT token from browser
drplr auth login <username> <password> Set username/password
drplr help Show this help
Expand All @@ -26,6 +33,7 @@ Options:
--private, -p Make upload/link private (default: public)
--password <password> Set password protection
--title <title> Set custom title (links only)
--board <board_name> Upload to specific board
--help, -h Show help

Global Flags:
Expand All @@ -48,6 +56,13 @@ Examples:
drplr note --file notes.txt --private
drplr note --code "console.log('hello')" --lang javascript --title "Code Snippet"

# Board management
drplr boards # List all boards
drplr board create "Project Assets" # Create new board
drplr board abc123 # Show board contents
drplr board update abc123 --title "New Name" # Update board title
drplr upload image.png --board "Project Assets" # Upload to specific board

# Using global flags
drplr image.png --porcelain # Only output the URL
drplr image.png --debug # Show API response details
Expand Down Expand Up @@ -127,6 +142,18 @@ async function main() {
return;
}

if (filteredArgs[0] === 'boards') {
const boardsCommand = handleBoardsCommand(filteredArgs.slice(1), globalOptions);
await executeCommand(boardsCommand, 'Board list');
return;
}

if (filteredArgs[0] === 'board') {
const boardCommand = handleBoardCommand(filteredArgs.slice(1), globalOptions);
await executeCommand(boardCommand, 'Board operation');
return;
}

// Default case: file upload
const uploadCommand = handleUploadCommand(filteredArgs, globalOptions);
await executeCommand(uploadCommand, 'Upload');
Expand Down
5 changes: 4 additions & 1 deletion lib/arg-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ function parseCommonArgs(args) {
const options = {
privacy: 'PUBLIC',
password: null,
title: null
title: null,
board: null
};

const remainingArgs = [];
Expand All @@ -25,6 +26,8 @@ function parseCommonArgs(args) {
options.password = args[++i];
} else if (arg === '--title') {
options.title = args[++i];
} else if (arg === '--board') {
options.board = args[++i];
} else if (arg === '--help' || arg === '-h') {
// Let each command handle help display
options.showHelp = true;
Expand Down
Loading