Commit 7ad6e611 authored by Robert Ricci's avatar Robert Ricci

Overhaul the way that command-line args are handled

Use the rather-nice racket/commandline library to parse them rather than
the ad-hoc junk I was using before. This makes it possible to pass in
the path to geni-lib
parent 88a4bfc7
......@@ -27,25 +27,25 @@ cloudlab: $(SOURCES)
-mkdir cloudlab-manual/
cd $(GENI_LIB_DIR)/docs && gmake html
cp -r $(GENI_LIB_DIR)/docs/build/html cloudlab-manual/geni-lib
scribble --htmls ++style cloudlab-manual.css ++arg clab ++arg geni-lib-dir=$(GENI_LIB_DIR) cloudlab-manual.scrbl
scribble --htmls ++style cloudlab-manual.css ++arg --clab ++arg --geni-lib-dir ++arg $(GENI_LIB_DIR) cloudlab-manual.scrbl
phantomnet: $(SOURCES)
scribble --htmls ++style phantomnet-manual.css ++arg pnet phantomnet-manual.scrbl
scribble --htmls ++style phantomnet-manual.css ++arg --pnet phantomnet-manual.scrbl
emulab: $(SOURCES)
scribble --htmls ++style emulab-manual.css ++arg elab emulab-manual.scrbl
scribble --htmls ++style emulab-manual.css ++arg --elab emulab-manual.scrbl
pdf/apt-manual.pdf: $(SOURCES)
scribble --dest pdf/ --pdf ++arg pdf $(TOPLEVEL).scrbl
scribble --dest pdf/ --pdf ++arg --pdf $(TOPLEVEL).scrbl
pdf/cloudlab-manual.pdf: $(SOURCES)
scribble --dest pdf/ --pdf ++arg clab ++arg pdf cloudlab-manual.scrbl
scribble --dest pdf/ --pdf ++arg --clab ++arg --pdf cloudlab-manual.scrbl
pdf/phantomnet-manual.pdf: $(SOURCES)
scribble --dest pdf/ --pdf ++arg pnet ++arg pdf phantomnet-manual.scrbl
scribble --dest pdf/ --pdf ++arg --pnet ++arg --pdf phantomnet-manual.scrbl
pdf/emulab-manual.pdf: $(SOURCES)
scribble --dest pdf/ --pdf ++arg elab ++arg pdf emulab-manual.scrbl
scribble --dest pdf/ --pdf ++arg --elab ++arg --pdf emulab-manual.scrbl
each: apt cloudlab phantomnet emulab
......
......@@ -10,7 +10,7 @@
]
@;{
@italic[(if (equal? doc-mode 'pdf)
@italic[(if (equal? (doc-mode) 'pdf)
(list "The HTML version of this manual is available at " (hyperlink apt-doc-url apt-doc-url))
(list "This manual is also available as a " (hyperlink "http://docs.aptlab.net/manual.pdf" "PDF")))]
}
......
......@@ -10,7 +10,7 @@
]
@;{
@italic[(if (equal? doc-mode 'pdf)
@italic[(if (equal? (doc-mode) 'pdf)
(list "The HTML version of this manual is available at " (hyperlink apt-doc-url apt-doc-url))
(list "This manual is also available as a " (hyperlink "http://docs.cloudlab.us/manual.pdf" "PDF")))]
}
......
......@@ -12,6 +12,7 @@
(require racket/port)
(require racket/vector)
(require racket/file)
(require racket/cmdline)
(provide (all-defined-out))
......@@ -21,39 +22,36 @@
(js-style-addition "download-code.js")
(make-css-addition "highlight-default.css"))))
; Check to see if we are building Apt or CloudLab documentation
(define tb-mode
(cond
((vector-member "clab" (current-command-line-arguments))
'clab)
((vector-member "pnet" (current-command-line-arguments))
'pnet)
((vector-member "elab" (current-command-line-arguments))
'elab)
(else 'apt)))
(define (apt?) (if (equal? tb-mode 'apt) #t #f))
(define (clab?) (if (equal? tb-mode 'clab) #t #f))
(define (pnet?) (if (equal? tb-mode 'pnet) #t #f))
(define (elab?) (if (equal? tb-mode 'elab) #t #f))
; Check to see if we are building for web or PDF; there is probably some
; nicer way to do this by inspecting the scribble/run state directly, but
; I haven't figured it out
(define doc-mode
(if (vector-member "pdf" (current-command-line-arguments))
'pdf
'html))
(define tb-mode (make-parameter 'apt))
(define doc-mode (make-parameter 'html))
(define geni-lib-dir (make-parameter null))
(command-line
#:program "testbed-manual"
#:once-any
["--apt" "Compile manual for Apt" (tb-mode 'apt)]
["--clab" "Compile manual for CloudLab" (tb-mode 'clab)]
["--pnet" "Compile manual for PhantomNet" (tb-mode 'pnet)]
["--elab" "Compile manual for Emulab" (tb-mode 'elab)]
#:once-each
["--pdf" "Compile PDF version of the manual" (doc-mode 'pdf)]
["--geni-lib-dir" gld "Give the path to geni-lib" (geni-lib-dir gld)]
)
(define (apt?) (if (equal? (tb-mode) 'apt) #t #f))
(define (clab?) (if (equal? (tb-mode) 'clab) #t #f))
(define (pnet?) (if (equal? (tb-mode) 'pnet) #t #f))
(define (elab?) (if (equal? (tb-mode) 'elab) #t #f))
(define (apt-vs-clab #:apt [apt-version (list)] #:clab [clab-version (list)] #:pnet [pnet-version (list)] #:elab [elab-version (list)])
(case tb-mode
(case (tb-mode)
('apt apt-version)
('clab clab-version)
('pnet pnet-version)
('elab elab-version)))
(define (apt-vs-clab* #:apt [apt-version ""] #:clab [clab-version ""] #:pnet [pnet-version ""] #:elab [elab-version ""])
(decode-flow (list (case tb-mode
(decode-flow (list (case (tb-mode)
('apt apt-version)
('clab clab-version)
('pnet pnet-version)
......@@ -72,27 +70,27 @@
(apt-vs-clab #:elab stuff))
(define apt-base-url
(case tb-mode
(case (tb-mode)
('apt "https://www.aptlab.net/")
('clab "https://www.cloudlab.us/")
('pnet "https://www.phantomnet.org/")
('elab "https://www.emulab.net/")))
(define apt-doc-url
(case tb-mode
(case (tb-mode)
('apt "http://docs.aptlab.net/")
('clab "http://docs.cloudlab.us/")
('pnet "http://docs.phantomnet.org/")
('pnet "http://docs.emulab.net/")))
(define forum-url
(case tb-mode
(case (tb-mode)
('apt "https://groups.google.com/forum/#!forum/apt-users")
('clab "https://groups.google.com/forum/#!forum/cloudlab-users")
('pnet "https://groups.google.com/forum/#!forum/phantomnet-users")
('elab "https://groups.google.com/forum/#!forum/emulab-users")))
(define tb (lambda () (case tb-mode
(define tb (lambda () (case (tb-mode)
('apt "Apt")
('clab "CloudLab")
('pnet "PhantomNet")
......@@ -128,7 +126,7 @@
[clabpath (string-append "screenshots/clab/" path)]
[pnetpath (string-append "screenshots/pnet/" path)]
[elabpath (string-append "screenshots/elab/" path)]
[fullpath (case tb-mode
[fullpath (case (tb-mode)
('apt aptpath)
('clab
(if (file-exists? clabpath)
......
......@@ -10,7 +10,7 @@
]
@;{
@italic[(if (equal? doc-mode 'pdf)
@italic[(if (equal? (doc-mode) 'pdf)
(list "The HTML version of this manual is available at " (hyperlink apt-doc-url apt-doc-url))
(list "This manual is also available as a " (hyperlink "http://docs.emulab.net/manual.pdf" "PDF")))]
}
......
......@@ -2,7 +2,7 @@
@(require "defs.rkt")
@(parse-sphinx-inventory "/Users/ricci/geni-lib/docs/build/html")
@(parse-sphinx-inventory (string-append (geni-lib-dir) "/docs/build/html"))
@title[#:tag "geni-lib" #:style main-style #:version apt-version]{Describing a profile with python and @tt{geni-lib}}
......
......@@ -10,7 +10,7 @@
]
@;{
@italic[(if (equal? doc-mode 'pdf)
@italic[(if (equal? (doc-mode) 'pdf)
(list "The HTML version of this manual is available at " (hyperlink apt-doc-url apt-doc-url))
(list "This manual is also available as a " (hyperlink "http://docs.phantomnet.org/manual.pdf" "PDF")))]
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment