NAME
File::Tudo - Tudo TODO file interface
SYNOPSIS
use File::Tudo;
# Simple convenience wrapper, useful for quick scripts
tudo "Fix that one issue";
# OO interface
my $tudo = File::Tudo.new('/path/to/TODO');
$tudo.todo.append: "Fix that one issue";
$tudo.write;
DESCRIPTION
File::Tudo is a Raku module for reading/writing simple TODO files.
Exported Subroutines
tudo
sub tudo(
$str,
:$path = default_todo
)
tudo()
is a simple convenience wrapper for File::Tudo that will quickly add an additional entry to the end of your TODO file. This can make it useful for reporting TODOs in your Raku scripts.
my @updates = gather for @packages -> $pkg {
...
}
tudo "There are updates that need taken care of!" if @updates;
$str
is the string you would like to add as an entry to your TODO file.
$path
is the path to the TODO file. Defaults to the return value of default_todo
, view its documentation for more information.
default_todo
sub default_todo()
default_todo()
returns an IO
object for the default TODO path. It will either be the path specified by the TODO_FILE
environment variable if set, or ~/TODO
otherwise.
Object-Oriented Interface
File::Tudo also exports the File::Tudo
class, providing an object-oriented interface for manipulating Tudo TODO files.
Methods
method new
method new(
$path = default_todo,
Bool :$read = True,
)
Returns a newly constructed File::Tudo.
$path
is the path to the TODO file. Defaults to the return value of default_todo
.
:$read
determines whether new()
will read TODO entries from the given file if they are present. If False
, new()
will ignore them and initialize an empty array for todo
.
method read
method read($file)
Reads a list of TODO entries from $file
, overwriting the previous todo
array. Returns the list of TODOs read.
method write
method write($file = $!path)
Writes the current todo
array to $file
. If $file
is not supplied, defaults to the value of the object's path
attribute.
Attributes
path
has IO $.path is rw
IO
object of the object's TODO file. Able to be modified.
todo
has Str @.todo is rw
Array of strings holding the list of TODO entries. Able to modified.
tudo
File::Tudo also comes with the tudo
script, which provides a nice command-line interface for manipulating File::Tudo TODO files.
ENVIRONMENT
BUGS
Don't be ridiculous...
Report bugs on my Codeberg, https://codeberg.org/1-1sam.
AUTHOR
Written by Samuel Young, samyoung12788@gmail.com.
COPYRIGHT
Copyright 2025, Samuel Young
This program is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0.
SEE ALSO
tudo