updated rodo.rkt and args.rkt

main
m455 2020-02-09 15:04:05 -05:00
parent 61f4fd4487
commit 3599f1ec1b
2 changed files with 6 additions and 12 deletions

View File

@ -10,8 +10,8 @@
(define (check-args args) (define (check-args args)
(let ([args-length (length args)] (let ([args-length (length args)]
[is-member? (lambda (command) [is-member? (lambda (command) (member (list-ref args 0) command))]
(member (list-ref args 0) command))]) [args-second (string->number (list-ref args 1))])
(cond (cond
[(equal? args-length 0) [(equal? args-length 0)
(utils:display-messages '(show-usage))] (utils:display-messages '(show-usage))]
@ -39,13 +39,9 @@
;; remove-command ;; remove-command
[(and (equal? args-length 2) [(and (equal? args-length 2)
(is-member? config:remove-commands) (is-member? config:remove-commands)
;; possibly replace this with something that checks (real? args-second)
;; the length, the creates a range with that, starting (or (positive? args-second)
;; from zero, and checks to see if the user input (zero? args-second)))
;; is a member of that list
(real? (string->number (list-ref args 1)))
(or (positive? (string->number (list-ref args 1)))
(zero? (string->number (list-ref args 1)))))
(utils:check-remove-conditions args)] (utils:check-remove-conditions args)]
[else (utils:display-messages '(show-usage))]))) [else (utils:display-messages '(show-usage))])))

View File

@ -1,9 +1,7 @@
#lang racket/base #lang racket/base
(require (prefix-in args: "args.rkt")) (require (prefix-in args: "args.rkt"))
(define (main args) (define (main args)
(let ([args-converted (vector->list args)]) (args:check-args (vector->list args)))
(args:check-args args-converted)))
(main (current-command-line-arguments)) (main (current-command-line-arguments))