As I mentioned in another post, you do not need to use cli
. Here’s the simplest variant:
#lang racket/base
(displayln (expt (string->number (vector-ref (current-command-line-arguments) 0)) 2))
;; $ racket file.rkt 8
;; 64
If you want to handle command-line parsing in a more principled way, you can use racket/cmdline
.
#lang racket/base
(require racket/cmdline)
(define n
(command-line
#:args (number)
(string->number number)))
(displayln (expt n 2))
;; $ racket file.rkt 8
;; 64
;; $ racket file.rkt
;; file.rkt: expects 1 <number> on the command line, given 0 arguments