Remove redundant comments.
This commit is contained in:
parent
a2c312741b
commit
ae5c8e1301
5 changed files with 2 additions and 23 deletions
|
@ -48,8 +48,6 @@ CSV loader.")
|
||||||
util-io
|
util-io
|
||||||
racket-kwargs)
|
racket-kwargs)
|
||||||
|
|
||||||
;; Curry version of line parser with configurable cell separator and
|
|
||||||
;; string delimiter. Returns a list of lists of strings.
|
|
||||||
(define/doc ((make-csv-line-parser separator string-delimiter) line)
|
(define/doc ((make-csv-line-parser separator string-delimiter) line)
|
||||||
("Curried version of fast CSV line parser with given separator and string delimiter.
|
("Curried version of fast CSV line parser with given separator and string delimiter.
|
||||||
|
|
||||||
|
@ -95,7 +93,7 @@ CSV loader.")
|
||||||
(loop (cdr tokens)
|
(loop (cdr tokens)
|
||||||
(cons (cons token (car res)) (cdr res))
|
(cons (cons token (car res)) (cdr res))
|
||||||
2)))))))) ; Continue inside quoted data
|
2)))))))) ; Continue inside quoted data
|
||||||
;; Parses given CSV lines list
|
|
||||||
(define*/doc (csv-parse-lines lines
|
(define*/doc (csv-parse-lines lines
|
||||||
#:separator (separator #\;)
|
#:separator (separator #\;)
|
||||||
#:string-delimiter (string-delimiter #\"))
|
#:string-delimiter (string-delimiter #\"))
|
||||||
|
@ -114,7 +112,6 @@ CSV loader.")
|
||||||
(cons (csv-parse-line line)
|
(cons (csv-parse-line line)
|
||||||
res)))))))
|
res)))))))
|
||||||
|
|
||||||
;; Loads given CSV file and parses its lines into lists
|
|
||||||
(define/doc (csv-parse fn . args)
|
(define/doc (csv-parse fn . args)
|
||||||
("Uses ```csv-parse-lines``` on lines read from given file ```fn```.")
|
("Uses ```csv-parse-lines``` on lines read from given file ```fn```.")
|
||||||
(call/cc
|
(call/cc
|
||||||
|
@ -126,7 +123,6 @@ CSV loader.")
|
||||||
(let ((lines (read-lines/no-bom (open-input-file fn))))
|
(let ((lines (read-lines/no-bom (open-input-file fn))))
|
||||||
(apply csv-parse-lines lines args)))))))
|
(apply csv-parse-lines lines args)))))))
|
||||||
|
|
||||||
;; Splits CSV into header and body based on the first empty row.
|
|
||||||
(define/doc (csv-split-header csv)
|
(define/doc (csv-split-header csv)
|
||||||
("Splits given loaded CSV into two tables at the first empty row.")
|
("Splits given loaded CSV into two tables at the first empty row.")
|
||||||
(let loop ((body csv)
|
(let loop ((body csv)
|
||||||
|
|
|
@ -60,7 +60,6 @@
|
||||||
repo
|
repo
|
||||||
args))
|
args))
|
||||||
|
|
||||||
;; Curried git repo command wrapper
|
|
||||||
(define*/doc (git repo (defmodesym 'output))
|
(define*/doc (git repo (defmodesym 'output))
|
||||||
("
|
("
|
||||||
* ```repo``` - a path to repository
|
* ```repo``` - a path to repository
|
||||||
|
@ -95,7 +94,6 @@ repository returning one or two values based on ```mode``` given:
|
||||||
'((" M" modified)
|
'((" M" modified)
|
||||||
("??" untracked)))
|
("??" untracked)))
|
||||||
|
|
||||||
;; Returns a dictionary of unknown, modified, deleted and added files
|
|
||||||
(define/doc (git-status repo)
|
(define/doc (git-status repo)
|
||||||
("
|
("
|
||||||
* ```repo``` - git repository
|
* ```repo``` - git repository
|
||||||
|
@ -125,15 +123,13 @@ Returns a dictionary with the following keys:
|
||||||
(cons fname
|
(cons fname
|
||||||
(ldict-ref res status '())))))))))
|
(ldict-ref res status '())))))))))
|
||||||
|
|
||||||
;; Returns detailed file annotation with each line being represented
|
|
||||||
;; by dictionary with keys from git output
|
|
||||||
(define/doc (git-blame repo fname)
|
(define/doc (git-blame repo fname)
|
||||||
("
|
("
|
||||||
* ```repo``` - git repository
|
* ```repo``` - git repository
|
||||||
* ```fname``` - file name (path) relative to the git repository
|
* ```fname``` - file name (path) relative to the git repository
|
||||||
|
|
||||||
Returns annotated source with information about originating commits
|
Returns annotated source with information about originating commits
|
||||||
for each line.
|
for each line represented by dictionary with keys from git output.
|
||||||
")
|
")
|
||||||
(let loop ((lines ((git repo) 'blame '--line-porcelain fname))
|
(let loop ((lines ((git repo) 'blame '--line-porcelain fname))
|
||||||
(blame (make-ldict))
|
(blame (make-ldict))
|
||||||
|
|
|
@ -52,8 +52,6 @@
|
||||||
(substring str 3)
|
(substring str 3)
|
||||||
str))))
|
str))))
|
||||||
|
|
||||||
;; Reads lines from given input port, discarding BOM at the beginning
|
|
||||||
;; of the first line if there is any.
|
|
||||||
(define/doc (read-lines/no-bom ip)
|
(define/doc (read-lines/no-bom ip)
|
||||||
("
|
("
|
||||||
* ```port``` - an input port
|
* ```port``` - an input port
|
||||||
|
@ -67,8 +65,6 @@ UTF-8 BOM, removes it.
|
||||||
(cons (remove-optional-bom (car lines))
|
(cons (remove-optional-bom (car lines))
|
||||||
(cdr lines)))))
|
(cdr lines)))))
|
||||||
|
|
||||||
;; Very simple shell command wrapper that returns lines produced by
|
|
||||||
;; given command.
|
|
||||||
(define/doc (get-process-output-lines cmd . args)
|
(define/doc (get-process-output-lines cmd . args)
|
||||||
("
|
("
|
||||||
* ```cmd``` - a string with the command
|
* ```cmd``` - a string with the command
|
||||||
|
@ -87,8 +83,6 @@ running the command given.
|
||||||
(let-values (((pid exit-ok? exit/signal) (process-wait pid)))
|
(let-values (((pid exit-ok? exit/signal) (process-wait pid)))
|
||||||
result))))
|
result))))
|
||||||
|
|
||||||
;; Very simple shell command wrapper that returns lines produced by
|
|
||||||
;; given command.
|
|
||||||
(define/doc (get-process-exit+output-lines cmd . args)
|
(define/doc (get-process-exit+output-lines cmd . args)
|
||||||
("
|
("
|
||||||
* ```cmd``` - a string with the command
|
* ```cmd``` - a string with the command
|
||||||
|
@ -107,8 +101,6 @@ all the lines produced by running the command given.
|
||||||
(let-values (((pid exit-ok? exit/signal) (process-wait pid)))
|
(let-values (((pid exit-ok? exit/signal) (process-wait pid)))
|
||||||
(values exit/signal result)))))
|
(values exit/signal result)))))
|
||||||
|
|
||||||
;; Invokes given command with given arguments, gives it all input
|
|
||||||
;; lines and returns the output lines.
|
|
||||||
(define/doc (process-send/recv cmd args . lines)
|
(define/doc (process-send/recv cmd args . lines)
|
||||||
("
|
("
|
||||||
* ```cmd``` - a string with command
|
* ```cmd``` - a string with command
|
||||||
|
|
|
@ -42,7 +42,6 @@ most scheme implementations.")
|
||||||
(chicken process)
|
(chicken process)
|
||||||
testing)
|
testing)
|
||||||
|
|
||||||
;; Returns a list with elements matching pred? predicate.
|
|
||||||
(define/doc (filter pred? lst)
|
(define/doc (filter pred? lst)
|
||||||
("* ```pred?``` - procedure accepting any value and returning #t or #f
|
("* ```pred?``` - procedure accepting any value and returning #t or #f
|
||||||
* ```lst``` - list to be filtered
|
* ```lst``` - list to be filtered
|
||||||
|
|
|
@ -41,27 +41,23 @@
|
||||||
(chicken base)
|
(chicken base)
|
||||||
(chicken format))
|
(chicken format))
|
||||||
|
|
||||||
;; If true, all stdout output is suppresed
|
|
||||||
(define/doc *stdout-quiet*
|
(define/doc *stdout-quiet*
|
||||||
("A boolean parameter which disables all output from procedures in this
|
("A boolean parameter which disables all output from procedures in this
|
||||||
module if its value is ```#t```.")
|
module if its value is ```#t```.")
|
||||||
quiet
|
quiet
|
||||||
(make-parameter #f))
|
(make-parameter #f))
|
||||||
|
|
||||||
;; Prints to stdout if not quiet
|
|
||||||
(define/doc (stdout-print . args)
|
(define/doc (stdout-print . args)
|
||||||
("If not quiet, passes ```args``` to ```print```.")
|
("If not quiet, passes ```args``` to ```print```.")
|
||||||
(when (not (*stdout-quiet*))
|
(when (not (*stdout-quiet*))
|
||||||
(apply print args)))
|
(apply print args)))
|
||||||
|
|
||||||
;; Prints formatted string to stdout if not quiet
|
|
||||||
(define/doc (stdout-printf fmt . args)
|
(define/doc (stdout-printf fmt . args)
|
||||||
("If not quiet, prints formatted string ```fmt``` by applying ```args```
|
("If not quiet, prints formatted string ```fmt``` by applying ```args```
|
||||||
to ```format``` procedure.")
|
to ```format``` procedure.")
|
||||||
(when (not (*stdout-quiet*))
|
(when (not (*stdout-quiet*))
|
||||||
(print (apply format fmt args))))
|
(print (apply format fmt args))))
|
||||||
|
|
||||||
;; Prints newline if not quiet
|
|
||||||
(define/doc (stdout-newline)
|
(define/doc (stdout-newline)
|
||||||
("If not quiet, calls ```(newline)```.")
|
("If not quiet, calls ```(newline)```.")
|
||||||
(when (not (*stdout-quiet*))
|
(when (not (*stdout-quiet*))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue