forked from caiorss/Functional-Programming
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.scm
More file actions
executable file
·65 lines (41 loc) · 1.25 KB
/
build.scm
File metadata and controls
executable file
·65 lines (41 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#! /usr/bin/scsh -s
!#
;; #!/usr/bin/scsh -o srfi-1 -o srfi-2 -o srfi-9 -o srfi-13 -o srfi-14 -o srfi-16 -o srfi-37 -e main -s
;; !#
(define (tree)
(run/string (tree)))
(define (ls)
(run/string (ls)))
(define (find-files directory pattern)
(port->list read-line
(run/port
(find ,directory -name ,pattern))))
;; Move file from origin to destine
;;
(define (mv orig dest)
(run (mv ,orig ,dest)))
(define (mv-backup filename)
(mv filename (string-append filename ".back" )))
;; Converts org-mode to html file
;;
(define (org->html filename)
(& (emacs ,filename --batch -f org-html-export-to-html --kill)))
;; Converts org-mode to github markdown file *.md
;;
(define (org->gfm filename)
(& (emacs -l ~/.emacs.d/init.el --batch --visit ,filename -funcall org-gfm-export-to-markdown --kill)))
(display "Running ... ")
(define (update)
;; Export all .org mode files to github markdown .md
(for-each (lambda (f)
(display (string-append "Updating " f))
(newline)
(org->gfm f)
(org->html f))
(find-files "." "*.org")))
(define (main . args)
(update)
(display "Update Finished.")
) ;;
(display "Running")
(main)