Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
|
|
@ -0,0 +1,27 @@
|
|||
#!/usr/bin/lasso9
|
||||
|
||||
local(
|
||||
arguments = $argv -> asarray,
|
||||
notesfile = file('notes.txt')
|
||||
)
|
||||
|
||||
#arguments -> removefirst
|
||||
|
||||
if(#arguments -> size) => {
|
||||
|
||||
#notesfile -> openappend
|
||||
#notesfile -> dowithclose => {
|
||||
#notesfile -> writestring(date -> format(`YYYY-MM-dd HH:mm:SS`) + '\n')
|
||||
#notesfile -> writestring('\t' + #arguments -> join(', ') + '\n')
|
||||
}
|
||||
|
||||
|
||||
|
||||
else
|
||||
#notesfile -> exists ? stdout(#notesfile -> readstring)
|
||||
}<lang>
|
||||
|
||||
Called with:
|
||||
<lang Lasso>./notes "Rosetta was here" Räksmörgås
|
||||
./notes First Second Last
|
||||
./notes
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
import os, times, strutils
|
||||
|
||||
if paramCount() == 0:
|
||||
try: stdout.write readFile("notes.txt")
|
||||
except IOError: discard
|
||||
else:
|
||||
var f = open("notes.txt", fmAppend)
|
||||
f.writeln getTime()
|
||||
f.writeln "\t", commandLineParams().join(" ")
|
||||
f.close()
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
constant cmd = command_line()
|
||||
constant filename = "notes.txt"
|
||||
integer fn
|
||||
object line
|
||||
if length(cmd)<3 then
|
||||
fn = open(filename,"r")
|
||||
if fn!=-1 then
|
||||
while 1 do
|
||||
line = gets(fn)
|
||||
if atom(line) then exit end if
|
||||
puts(1,line)
|
||||
end while
|
||||
close(fn)
|
||||
end if
|
||||
else
|
||||
fn = open(filename,"a") -- if such file doesn't exist it will be created
|
||||
printf(fn,"%d-%02d-%02d %d:%02d:%02d\n",date())
|
||||
printf(fn,"\t%s\n",join(cmd[3..$]))
|
||||
close(fn)
|
||||
end if
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
var file = %f'notes.txt';
|
||||
|
||||
if (ARGV.len > 0) {
|
||||
var fh = file.open_a;
|
||||
fh.say(Time.local.ctime + "\n\t" + ARGV.join(" "));
|
||||
fh.close;
|
||||
} else {
|
||||
file.open_r.each { .print };
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
import Foundation
|
||||
|
||||
let args = Process.arguments
|
||||
let manager = NSFileManager()
|
||||
let currentPath = manager.currentDirectoryPath
|
||||
var err:NSError?
|
||||
|
||||
// Create file if it doesn't exist
|
||||
if !manager.fileExistsAtPath(currentPath + "/notes.txt") {
|
||||
println("notes.txt doesn't exist")
|
||||
manager.createFileAtPath(currentPath + "/notes.txt", contents: nil, attributes: nil)
|
||||
}
|
||||
|
||||
// handler is what is used to write to the file
|
||||
let handler = NSFileHandle(forUpdatingAtPath: currentPath + "/notes.txt")
|
||||
|
||||
// Print the file if there are no args
|
||||
if args.count == 1 {
|
||||
let str = NSString(contentsOfFile: currentPath + "/notes.txt", encoding: NSUTF8StringEncoding, error: &err)
|
||||
println(str!)
|
||||
exit(0)
|
||||
}
|
||||
|
||||
let time = NSDate()
|
||||
let format = NSDateFormatter()
|
||||
let timeData = (format.stringFromDate(time) + "\n").dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)
|
||||
format.dateFormat = "yyyy.MM.dd 'at' HH:mm:ss zzz"
|
||||
|
||||
// We're writing to the end of the file
|
||||
handler?.seekToEndOfFile()
|
||||
handler?.writeData(timeData!)
|
||||
|
||||
var str = "\t"
|
||||
for i in 1..<args.count {
|
||||
str += args[i] + " "
|
||||
}
|
||||
|
||||
str += "\n"
|
||||
|
||||
let strData = str.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)
|
||||
handler?.writeData(strData!)
|
||||
Loading…
Add table
Add a link
Reference in a new issue