merged in usage branch

This commit is contained in:
Valerie Wolfe 2024-03-11 23:09:44 -04:00
commit 6c2d327c4b
7 changed files with 67 additions and 7 deletions

View file

@ -1,4 +1,4 @@
PLYADES I'll take care of you.\nORESTES It's rotten work.\nPLYADES Not to me. Not if it's you.\n\n - Anne Carson, Euripides
me: good night darling. I'm so happy to be able to fall asleep\nnext to you\n\nmy gf: *already rotating like a kebab to ensure maximum duvet\ntheft*\n\n - @davideastUK, Twitter.
<sawasawako>\nidc anymore i think we should be a burden to each other\n\nand yes this includes a certain degree of tolerance for emotional\nburden, all else being equal. my love for you, and loyalty to\nyou, is not dependent on how easy you make it for me to love you.\ni don't value you for how little trouble you cause me. i want to\nlearn how to take you for who you are, instead of who i want you\nto be or who i think you should be\n\n<starrbear>\nThe measure of any relationship should not be whether loving\nsomeone is work, but whether it is work that you are glad to do.\n\n - tumblr exchange
I want to eat the sunbeam flaring in your lovel body,\nthe sovereign nose of your arrogant face,\nI want to eat the fleeting shade of your lashes,\n - Pablo Neruda
I want to eat the sunbeam flaring in your lovely body,\nthe sovereign nose of your arrogant face,\nI want to eat the fleeting shade of your lashes,\n - Pablo Neruda

View file

@ -1,3 +1,3 @@
the distortion of "there is potential profit we did not earn" as\n"there is money we lost" is fascinating and disgusting to me.\n"megamediacongolmerate lost $1,000,000,000 to piracy this year"\nis a flat out lie. it is not true. they did not have a billion\ndollars, that they now do not have. they felt entitled to one\nbillion dollars, that they did not have, and still do not have.\nit's an infuriating perversion of the truth.\n\n - strawberry-bundae, tumblr post
I'm tired of being the butt of everyone's jokes.\nI'm tired of being talked about like I'm not here.\nI'm tired of being a political token. Tired of being under\nscrutiny for no reason. Tired of being presumed guilty until\nproven innocent. Tired of being used as a cudgel to put down\nother trans people. I'm tired of having to constantly be on my\nbest behavior lest someone decide to ruin my life over some\ninsignificant slight. And I'm tired, most of all, because the\npeople who do all this stuff also surround themselves with legions\nof sycophants who'll constantly jerk them off about how good and\nwoke and progressive they are and about how the big scary\nhysterical ****** is just being mean for no reason.\n\nI'm tired. I just wanna play video games and read books about\nelves. I didn't sign up for whatever the fuck this is.\n\n - natalieironside, tumblr post.
> The less you eat, drink and read books; the less you go to the\n> theatre, the dance hall, the public-house; the less you think,\n> love, theorize, paint, sing, fence, etc., the more you save—the\n> greater becomes your treasure which neither moths nor dust will\n> devour—your capital. The less you are, the more you have; the\n> less you express your own life, the greater is your alienated\n> life—the greater is the store of your estranged being.\n\n - Karl Marx, Economic and Philosophic Manuscripts or 1844
"The less you eat, drink and read books; the less you go to the theatre, the\ndance hall, the public-house; the less you think, love, theorize, paint, sing,\nfence, etc., the more you save—the greater becomes your treasure which neither\nmoths nor dust will devour—your capital. The less you are, the more you have;\nthe less you express your own life, the greater is your alienated life—the\ngreater is the store of your estranged being."\n\n - Karl Marx, Economic and Philosophic Manuscripts or 1844

View file

@ -1,7 +1,6 @@
█████████████████████\n█████████████████████\n█████████████████████\n█████████████████████\n█████████████████████\n█████████████████████
██████████████████\n██████████████████\n██████████████████\n██████████████████\n██████████████████
██████████████████\n█████████████████\n████████████████\n████████████████\n█████████████████\n██████████████████
BE GAY DO CRIME!
"Can you write in it that I said thank you to gay people"\n\n - Gianni Matragrano, ULTRAKILL credits
> I'd like to see the gay revolution get started... If a\n> transvestite doesn't say "I'm gay and I'm proud and I'm a\n> transvestite," then nobody else is going to hop up there and\n> say "I'm gay and I'm proud and I'm a transvestite" for them.\n\n - Marsha P Johnson, Stonewall Rioter
"No pride for some of us without liberation for all of us."\n\n - Marsha P Johnson, Stonewall Rioter

31
src/Info.cs Normal file
View file

@ -0,0 +1,31 @@
using System;
using System.IO;
public static class Globals {
public const string VERSION = "0.1.0";
public const string DEFAULT_PATH = "/usr/share/fortune-cs/";
}
public static class Usage {
public static void HelpText() {
VersionText();
Console.WriteLine(@"Valerie Wolfe <sleeplessval@gmail.com>
Shows quotes from a set of files.
usage: fortune-cs");
}
public static void ListText(string[] files) {
foreach(var file in files) {
var fileName = Path.GetFileNameWithoutExtension(file);
Console.WriteLine(fileName);
}
}
public static void VersionText() {
Console.WriteLine("fortune-cs v" + Globals.VERSION);
}
}

View file

@ -2,22 +2,40 @@ using System;
using System.IO;
using System.Security.Cryptography;
// use merge function if given multiple arguments
if(args.Length > 0) {
// handle help flag
if(Utilities.HasFlags(args, "-h", "--help")) {
Usage.HelpText();
return 0;
}
// handle version flag
if(Utilities.HasFlags(args, "-v", "--version")) {
Usage.VersionText();
return 0;
}
// handle merge flag
if(Utilities.HasFlags(args, "-m", "--merge")) {
Utilities.Merge(args);
return 0;
}
// make sure fortune directory exists
var resourcePath = "/usr/share/fortune-cs/";
var resourcePath = Globals.DEFAULT_PATH;
if(!Directory.Exists(resourcePath)) {
Console.WriteLine("fortune-cs: directory '/usr/share/fortune-cs/' does not exist");
Console.WriteLine($"fortune-cs: directory '${resourcePath}' does not exist");
return 1;
}
// pull file list
var files = Directory.GetFiles(resourcePath, "*.txt");
// handle list flag
if(Utilities.HasFlags(args, "-l", "--list")) {
Usage.ListText(files);
return 0;
}
// choose a file and line
var file = files[RandomNumberGenerator.GetInt32(files.Length)];
var lines = File.ReadAllLines(file);

View file

@ -4,6 +4,18 @@ using System.IO;
public static class Utilities {
/// <summary>
/// Checks if a given flag is set in `args`.
/// </summary>
public static bool HasFlags(string[] args, params string[] flags) {
foreach(string flag in flags)
// using `Array.IndexOf` since including Linq for `array.Contains` increases binary size
if(Array.IndexOf(args, flag) != -1)
return true;
return false;
}
public static void Merge(params string[] files) {
// hashset to prevent duplicates
var members = new HashSet<string>();