私が作業しているモジュールの例ではdocopt
を使用していますが、すべてのオプションのデフォルト値は1を除いて動作しています。問題を特定しようとしているオプションを含むコードをすべて修正しましたが、デフォルト値は使用されません。なぜ私のdocoptオプションはデフォルト値を持っていませんか?
私のオプション・ブロックは、次のようになります。
Options:
--help Show this message and exit
--version Show version info and exit
-w WIDTH --width=WIDTH The out to out width of the deck (feet) [default: 73]
-g GIRDERS --girders=GIRDERS The number of girders [default: 8]
-h HEIGHT --height=HEIGHT The height of the girders (inches) [default: 56]
-t THICK --thick=THICK The deck thickness (inches) [default: 8]
-a ADIM --adim=ADIM The "A" dimension, max deck thick @ CL girder [default: 12]
-l LSLP --leftslope=LSLP The left-hand deck slope (ft/ft) [default: -0.02]
-r RSLP --rightslope=RSLP The right-hand deck slope (ft/ft) [default: -0.02]
-c --center Indicates pivot point is at center of bridge
-o OFFSET --offset=OFFSET The offset of pivot point from center [default: 0]
girders
オプションはデフォルト値を持っていることはありません!
私は数回this questionを再読しましたが、無関係です。
私の推測:各オプションの説明の前に少なくとも* 2 *スペースが必要です – jfs
私の推測も - 同じ問題がありました。http://stackoverflow.com/questions/13995352/why-are-defaults-notコマンドライン引数の辞書からのdocop/20283560#20283560 – hargriffle