Skip to content

thecodedmind/tcm-d-libs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

tcm-d-libs

Collection of in-progress utilities for D-lang. (WIP)

opthandler

import std.stdio, std.regex, std.algorithm, tcm.opthandler;

void main(string[] argv){
  auto opts = new Opt(argv);
  writeln(opts.command());
  writeln(opts.command(1));
  writeln(opts.value("file"));
  writeln(opts.flag("debug"));
}

Outputs:

./app --debug writeln bork --file:me
writeln
bork
me
true

strplus

just a clean API for checking if a string contains a substring

"this is a test string".contains("test"); // returns true

arrayplus

same as strplus.contains

["this", "is", "a", "test"].contains("test"); // returns true

randplus

int i = rand(10); //returns random number between 0 and 10
int r = randrange(10, 100); // returns random number between 10 and 100

colours

Simple class for terminal colours. (Linux) The API is;

.*colour*
.bright_*colour*
.bg_*colour*
.bg_bright_*colour*
.bold
.underline
.reversed
.reset
.fg(colour_id)
.bg(colour_id)

Examples:

auto c = new Colours();
writeln(c.red~"This text is red when it prints!"~c.reset); //reset clears all formatting
writeln(c.fg(125)~"Also takes a colour ID, for fg for foreground, fg for background"~c.reset); 

About

Collection of in-progress utilities for D-lang. (WIP)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages