mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-06 00:27:24 +00:00
Merge branch 'easter-egg/shakespeare' into 'main'
easter-egg/shakespeare See merge request soapbox-pub/shakespeare!50
This commit is contained in:
commit
f2f1941a30
4 files changed
+162
-6
No files matched your search
@@ -11,6 +11,9 @@ export interface ShellCommand {
|
|||||||
/** Usage syntax for the command */
|
/** Usage syntax for the command */
|
||||||
usage: string;
|
usage: string;
|
||||||
|
|
||||||
|
/** If true, this command is hidden from help and command listings (for easter eggs) */
|
||||||
|
isEasterEgg?: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute the command with the given arguments
|
* Execute the command with the given arguments
|
||||||
* @param args Array of command arguments (excluding the command name itself)
|
* @param args Array of command arguments (excluding the command name itself)
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ export { MvCommand } from './mv';
|
|||||||
export { PwdCommand } from './pwd';
|
export { PwdCommand } from './pwd';
|
||||||
export { RmCommand } from './rm';
|
export { RmCommand } from './rm';
|
||||||
export { SedCommand } from './sed';
|
export { SedCommand } from './sed';
|
||||||
|
export { ShakespeareCommand } from './shakespeare';
|
||||||
export { SortCommand } from './sort';
|
export { SortCommand } from './sort';
|
||||||
export { TailCommand } from './tail';
|
export { TailCommand } from './tail';
|
||||||
export { TouchCommand } from './touch';
|
export { TouchCommand } from './touch';
|
||||||
|
|||||||
@@ -0,0 +1,148 @@
|
|||||||
|
import type { ShellCommand, ShellCommandResult } from "./ShellCommand";
|
||||||
|
import { createSuccessResult } from "./ShellCommand";
|
||||||
|
|
||||||
|
|
||||||
|
const ASCII_QUILLY = `
|
||||||
|
|
||||||
|
|
||||||
|
@@@@@@%
|
||||||
|
@@ @@@
|
||||||
|
@@ @@@
|
||||||
|
@@ @@@
|
||||||
|
@@%%% %@@@ @@@
|
||||||
|
@@@@%@%@% @@@@ %@@@@%
|
||||||
|
@@@@@ @%% @@ @@@@@@@
|
||||||
|
@@@@@ @@ @@@@@@%
|
||||||
|
@@@@ @%#@@ @@@@@@
|
||||||
|
@@%@@@@@@@@ %@@@@@@%
|
||||||
|
@@% @ @@@ %@% @@
|
||||||
|
@@ @@ %@@ @@
|
||||||
|
@@ @@@%@@ %@@
|
||||||
|
@@@@@%@@%@@@%# @@
|
||||||
|
@@@@@@@%@@@@@@@@ @@
|
||||||
|
@@ @@ @@
|
||||||
|
@@ @@@ @@ @@
|
||||||
|
@@ @@@ @@ @@
|
||||||
|
@@ @@@ @@ @@
|
||||||
|
@@ @@@ @@ @@
|
||||||
|
@@ @@@ @@ @@
|
||||||
|
@@ @@@ @@ @@
|
||||||
|
@@ %@@ @@ @@
|
||||||
|
@@ @@@ @@@ @@
|
||||||
|
@@ @@@@@@@@% @@
|
||||||
|
@@% %@% @@@
|
||||||
|
@@ @@
|
||||||
|
@@@ @@@
|
||||||
|
@@@@@@@@@@@@%
|
||||||
|
@@%
|
||||||
|
`;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Collection of Shakespeare poems
|
||||||
|
* Replace these placeholders with actual Shakespeare sonnets/excerpts
|
||||||
|
*/
|
||||||
|
const POEMS = [
|
||||||
|
`From The Phoenix and the Turtle
|
||||||
|
|
||||||
|
Here the anthem doth commence:
|
||||||
|
Love and constancy is dead;
|
||||||
|
Phoenix and the turtle fled
|
||||||
|
In a mutual flame from hence.
|
||||||
|
|
||||||
|
So they loved, as love in twain
|
||||||
|
Had the essence but in one;
|
||||||
|
Two distincts, division none:
|
||||||
|
Number there in love was slain.
|
||||||
|
|
||||||
|
Hearts remote, yet not asunder;
|
||||||
|
Distance, and no space was seen
|
||||||
|
'Twixt the turtle and his queen:
|
||||||
|
But in them it were a wonder.
|
||||||
|
|
||||||
|
So between them love did shine,
|
||||||
|
That the turtle saw his right
|
||||||
|
Flaming in the phoenix' sight;
|
||||||
|
Either was the other's mine.`,
|
||||||
|
|
||||||
|
`From Romeo and Juliet - Act III, Scene 5; Capulet’s orchard
|
||||||
|
|
||||||
|
Juliet. Yon light is not day-light, I know it, I:
|
||||||
|
It is some meteor that the sun exhales,2110
|
||||||
|
To be to thee this night a torch-bearer,
|
||||||
|
And light thee on thy way to Mantua:
|
||||||
|
Therefore stay yet; thou need'st not to be gone.
|
||||||
|
|
||||||
|
Romeo. Let me be ta'en, let me be put to death;
|
||||||
|
I am content, so thou wilt have it so.2115
|
||||||
|
I'll say yon grey is not the morning's eye,
|
||||||
|
'Tis but the pale reflex of Cynthia's brow;
|
||||||
|
Nor that is not the lark, whose notes do beat
|
||||||
|
The vaulty heaven so high above our heads:
|
||||||
|
I have more care to stay than will to go:2120
|
||||||
|
Come, death, and welcome! Juliet wills it so.
|
||||||
|
How is't, my soul? let's talk; it is not day.
|
||||||
|
|
||||||
|
Juliet. It is, it is: hie hence, be gone, away!
|
||||||
|
It is the lark that sings so out of tune,
|
||||||
|
Straining harsh discords and unpleasing sharps.2125
|
||||||
|
Some say the lark makes sweet division;
|
||||||
|
This doth not so, for she divideth us:
|
||||||
|
Some say the lark and loathed toad change eyes,
|
||||||
|
O, now I would they had changed voices too!
|
||||||
|
Since arm from arm that voice doth us affray,2130
|
||||||
|
Hunting thee hence with hunt's-up to the day,
|
||||||
|
O, now be gone; more light and light it grows.
|
||||||
|
|
||||||
|
Romeo. More light and light; more dark and dark our woes!`,
|
||||||
|
|
||||||
|
`From A lover's complaint
|
||||||
|
|
||||||
|
'Now all these hearts that do on mine depend,
|
||||||
|
Feeling it break, with bleeding groans they pine;
|
||||||
|
And supplicant their sighs to you extend,
|
||||||
|
To leave the battery that you make 'gainst mine,
|
||||||
|
Lending soft audience to my sweet design,280
|
||||||
|
And credent soul to that strong-bonded oath
|
||||||
|
That shall prefer and undertake my troth.'
|
||||||
|
|
||||||
|
'This said, his watery eyes he did dismount,
|
||||||
|
Whose sights till then were levell'd on my face;
|
||||||
|
Each cheek a river running from a fount285
|
||||||
|
With brinish current downward flow'd apace:
|
||||||
|
O, how the channel to the stream gave grace!
|
||||||
|
Who glazed with crystal gate the glowing roses
|
||||||
|
That flame through water which their hue encloses.
|
||||||
|
|
||||||
|
'O father, what a hell of witchcraft lies290
|
||||||
|
In the small orb of one particular tear!
|
||||||
|
But with the inundation of the eyes
|
||||||
|
What rocky heart to water will not wear?
|
||||||
|
What breast so cold that is not warmed here?
|
||||||
|
O cleft effect! cold modesty, hot wrath,295
|
||||||
|
Both fire from hence and chill extincture hath.`,
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implementation of the 'shakespeare' command
|
||||||
|
* Display ASCII art and a random Shakespeare poem - an easter egg!
|
||||||
|
*/
|
||||||
|
export class ShakespeareCommand implements ShellCommand {
|
||||||
|
name = 'shakespeare';
|
||||||
|
description = 'Display a quote from the Bard himself';
|
||||||
|
usage = 'shakespeare';
|
||||||
|
isEasterEgg = true;
|
||||||
|
|
||||||
|
async execute(_args: string[], _cwd: string, _input?: string): Promise<ShellCommandResult> {
|
||||||
|
// Get random poem
|
||||||
|
const randomPoem = POEMS[Math.floor(Math.random() * POEMS.length)];
|
||||||
|
|
||||||
|
// Combine ASCII art and poem
|
||||||
|
const output = `${ASCII_QUILLY}
|
||||||
|
|
||||||
|
${randomPoem}
|
||||||
|
|
||||||
|
`;
|
||||||
|
|
||||||
|
return createSuccessResult(output);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -25,6 +25,7 @@ import {
|
|||||||
PwdCommand,
|
PwdCommand,
|
||||||
RmCommand,
|
RmCommand,
|
||||||
SedCommand,
|
SedCommand,
|
||||||
|
ShakespeareCommand,
|
||||||
SortCommand,
|
SortCommand,
|
||||||
TailCommand,
|
TailCommand,
|
||||||
TouchCommand,
|
TouchCommand,
|
||||||
@@ -85,6 +86,7 @@ export class ShellTool implements Tool<ShellToolParams> {
|
|||||||
this.registerCommand(new PwdCommand());
|
this.registerCommand(new PwdCommand());
|
||||||
this.registerCommand(new RmCommand(fs));
|
this.registerCommand(new RmCommand(fs));
|
||||||
this.registerCommand(new SedCommand(fs));
|
this.registerCommand(new SedCommand(fs));
|
||||||
|
this.registerCommand(new ShakespeareCommand());
|
||||||
this.registerCommand(new SortCommand(fs));
|
this.registerCommand(new SortCommand(fs));
|
||||||
this.registerCommand(new TailCommand(fs));
|
this.registerCommand(new TailCommand(fs));
|
||||||
this.registerCommand(new TouchCommand(fs));
|
this.registerCommand(new TouchCommand(fs));
|
||||||
@@ -493,13 +495,15 @@ export class ShellTool implements Tool<ShellToolParams> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get list of available commands
|
* Get list of available commands (excludes hidden easter eggs)
|
||||||
*/
|
*/
|
||||||
getAvailableCommands(): Array<{ name: string; description: string; usage: string }> {
|
getAvailableCommands(): Array<{ name: string; description: string; usage: string }> {
|
||||||
return Array.from(this.commands.values()).map(cmd => ({
|
return Array.from(this.commands.values())
|
||||||
name: cmd.name,
|
.filter(cmd => !cmd.isEasterEgg) // Hide easter egg commands from help
|
||||||
description: cmd.description,
|
.map(cmd => ({
|
||||||
usage: cmd.usage,
|
name: cmd.name,
|
||||||
}));
|
description: cmd.description,
|
||||||
|
usage: cmd.usage,
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user