Data update
This commit is contained in:
parent
81fd053722
commit
52a6ef48dd
10248 changed files with 63654 additions and 6775 deletions
|
|
@ -0,0 +1,41 @@
|
|||
BEGIN # display or update NOTES.txt depending on the command line options #
|
||||
|
||||
PR read "files.incl.a68" PR # include file utilities #
|
||||
|
||||
# returns a string representation of v with at least two digits and with #
|
||||
# leading zeros #
|
||||
OP F = ( INT v )STRING:
|
||||
BEGIN
|
||||
INT abs v = ABS v;
|
||||
STRING result := whole( abs v, 0 );
|
||||
IF abs v < 10 AND v >= 0 THEN "0" +=: result FI;
|
||||
IF v < 0 THEN "-" +=: result FI;
|
||||
result
|
||||
END # F # ;
|
||||
|
||||
STRING notes file = "NOTES.txt"; # notes database #
|
||||
# check for notes on the command line - ALGOL 68G will expect them to #
|
||||
# follow "--" #
|
||||
INT notes start := 0;
|
||||
FOR arg pos FROM 2 TO argc WHILE notes start = 0 DO
|
||||
IF argv( arg pos ) = "--" THEN notes start := arg pos FI
|
||||
OD;
|
||||
IF notes start = 0 OR notes start = argc
|
||||
THEN # no command line args, show the existing notes #
|
||||
IF PRINTLINES notes file < 0
|
||||
THEN print( ( "Unable to open ", notes file, newline ) )
|
||||
FI
|
||||
ELSE # add a note specified by the command line #
|
||||
[]INT date = local time[ AT 1 ];
|
||||
[ 1 : 3 ]STRING new note;
|
||||
new note[ 1 ] := F date[ 1 ] + "/" + F date[ 2 ] + "/" + F date[ 3 ]
|
||||
+ "."+ F date[ 4 ] + ":" + F date[ 5 ] + ":" + F date[ 6 ];
|
||||
new note[ 2 ] := REPR 9 + argv( notes start + 1 );
|
||||
FOR arg pos FROM notes start + 2 TO argc DO new note[ 2 ] +:= " " + argv( arg pos ) OD;
|
||||
new note[ 3 ] := "";
|
||||
IF NOT ( notes file APPENDLINES new note )
|
||||
THEN print( ( "Unable to append the notes", newline ) )
|
||||
FI
|
||||
FI
|
||||
|
||||
END
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
class Notes {
|
||||
function : Main(args : String[]) ~ Nil {
|
||||
filename := "NOTES.TXT";
|
||||
|
||||
if(args->Size() > 0) {
|
||||
buffer := System.Time.Date->New()->ToString() + "\n\t";
|
||||
each(arg in args) {
|
||||
buffer += arg + " ";
|
||||
};
|
||||
buffer += "\n\n";
|
||||
|
||||
writer := System.IO.Filesystem.FileWriter->New(filename, true);
|
||||
writer->WriteString(buffer);
|
||||
writer->Close();
|
||||
}
|
||||
else {
|
||||
reader := System.IO.Filesystem.FileReader->New(filename);
|
||||
if(reader->IsOpen()) {
|
||||
line : String;
|
||||
do {
|
||||
line := reader->ReadLine();
|
||||
if(line <> Nil) {
|
||||
line->PrintLine();
|
||||
};
|
||||
}
|
||||
while(line <> Nil);
|
||||
};
|
||||
|
||||
reader->Close();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
#
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if
|
||||
declare NOTES=$HOME/notes.txt
|
||||
|
|
@ -6,7 +6,8 @@ if
|
|||
then
|
||||
{
|
||||
date
|
||||
echo " $*"
|
||||
echo -e "\t$*"
|
||||
} >> $NOTES
|
||||
else [[ -r $NOTES ]] && more $NOTES
|
||||
elif [[ -r $NOTES ]]
|
||||
then more $NOTES
|
||||
fi
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue