diff --git a/src/lib/options.ts b/src/lib/options.ts
new file mode 100644
index 0000000..3568f9d
--- /dev/null
+++ b/src/lib/options.ts
@@ -0,0 +1,33 @@
+import { AsText, TextPiece } from '../words';
+
+type SwitchPattern = Record<string, number> & {
+  min?: number;
+  max?: number;
+};
+type SwitchOutput<P extends SwitchPattern> = {
+  [K in keyof P]: K extends "min" | "max"
+    ? never
+    : P[K] extends 0
+    ? boolean
+    : string[];
+} & {
+  error?: string;
+};
+
+// TODO: tests and error handling
+export function getOpt<P extends SwitchPattern>(
+  argv: TextPiece[],
+  switches: P
+): [SwitchOutput<P>, ...string[]] {
+  const [flags, textPieces] = getOptRaw(argv, switches);
+  return [flags, ...textPieces.map(AsText)];
+}
+
+export function getOptRaw<P extends SwitchPattern>(
+  argv: TextPiece[],
+  switches: P
+): [SwitchOutput<P>, TextPiece[]] {
+  const [, ...words] = argv;
+  // TODO: handle min/max
+  return [{} as SwitchOutput<P>, words];
+}