我正在用 Common Lisp 编写一个实用程序并用 Clozure CL 构建它;我希望能够在-d
程序中使用命令行选项,但由于某种原因,这个特定选项无法通过(ccl::command-line-arguments)
. 这是一个最小的例子:
(defun main ()
(format t "~s~%" (ccl::command-line-arguments))
(quit))
我编译了
(save-application "opts"
:toplevel-function 'main
:prepend-kernel t)
这是一些示例输出:
~/dev/scratch$ ./opts -c -a -e
("./opts" "-c" "-a" "-e")
~/dev/scratch$ ./opts -c -d -e
("./opts" "-c" "-e")
~/dev/scratch$ ./opts -b --frogs -c -d -e -f -g -h --eye --jay -k -l
("./opts" "--frogs" "-c" "-e" "-f" "-g" "-h" "--eye" "--jay" "-k" "-l")
和选项似乎迷路了-b
。命令行参数的-d
文档不是很有帮助。我想可能是因为它本身作为一个论点,那个选项可能由于某种原因被吃掉了,但它没有被吃掉(被吃掉了),它确实被吃掉了,哪些没有被吃掉。保存应用程序似乎没有任何帮助。ccl
ccl
-b
-d
-e
-l
我很确定它是 Clozure 特有的(而不是说,吃它们的壳),因为其他东西似乎得到了所有的论点:
#!/usr/bin/python
import sys
print sys.argv
产量
~/dev/scratch$ ./opts.py -a -b -c -d -e
['./opts.py', '-a', '-b', '-c', '-d', '-e']
和
#!/bin/bash
echo "$@"
给
~/dev/scratch$ ./opts.sh -a -b -c -d -e
-a -b -c -d -e
这一切都发生在 lubuntu 15.10bash
作为外壳。
如果有人能解释为什么会发生这种情况,或者我如何最终得到所有命令行开关,我将不胜感激。
谢谢。