rodo/args.rkt

38 lines
830 B
Racket
Raw Normal View History

2018-04-12 18:25:19 +00:00
#lang racket/base
(require racket/vector
"config.rkt"
"todo-file.rkt"
"init.rkt"
"list-hash.rkt"
"messages.rkt")
(provide (all-defined-out))
(define (check-args args)
(let
([args-length (vector-length args)])
(cond
[(and
(equal? args-length 1)
(equal? (vector-member list-command args) 0))
(show-list)]
[(and
(equal? args-length 2)
(equal? (vector-member add-command args) 0))
(add-item args)]
[(and
(equal? args-length 2)
(equal? (vector-member remove-command args) 0))
(remove-item args)]
[(and
(equal? args-length 1)
(equal? (vector-member initialize-command args) 0))
(initialize)]
[else
(d-hash-ref messages 'show-usage)])))