Upgrade to Pro — share decks privately, control downloads, hide ads and more …

JSON をそこそこ見やすくする CUI ツールを Objective-C で作ったときの話

JSON をそこそこ見やすくする CUI ツールを Objective-C で作ったときの話

第50回 Cocoa勉強会関西 - iOS/Macアプリ開発勉強会
発表資料

griffin-stewie

June 01, 2013
Tweet

More Decks by griffin-stewie

Other Decks in Technology

Transcript

  1. ࣗݾ঺հ •େࡕͰ iOS ΞϓϦ։ൃͷ࢓ࣄΛ͍ͯ͠ ·͢ •Cocoa ྺ͸ 5 ೥ఔ౓ •SafariGestures

    ͱ͔ SafariTabMemento ͱ ͔ Safari ͷ SIMBL ϓϥάΠϯΛ @canberland ͱҰॹʹ࡞ͬͯ·ͨ͠ɻ 13೥6݄1೔౔༵೔
  2. •DDCli ͷσϦήʔτϝιουΛ2࣮ͭ૷͢Δ •1ͭ͸ Φϓγϣϯͷఆٛ༻ • ड͚෇͚͍ͨίϚϯυϥΠϯΦϓγϣϯΛߏ଄ମͷ ഑ྻͱͯ͠ఆٛ •΋͏1ͭ͸ CUI ΞϓϦͱͯ͠ͷΤϯτϦϙΠϯτ

    • ίϚϯυϥΠϯΦϓγϣϯ͸σϦήʔτΦϒδΣΫ τʹ KVC ܦ༝ͰηοτࡁΈ • ͦͷ΄͔ͷҾ਺͕౉͞ΕΔ 13೥6݄1೔౔༵೔
  3. 1. main.m ͷมߋ int main(int argc, const char * argv[])

    { int result = 0; @autoreleasepool { result = DDCliAppRunWithClass( [CSJSONPrettyPrint class]); } return result; } 13೥6݄1೔౔༵೔
  4. •- (void)application:(DDCliApplication *)app willParseOptions:(DDGetoptLongParser *)optionParser •application:(DDCliApplication *)app runWithArguments:(NSArray *)arguments ͷલʹݺ

    ͹ΕΔ •DDGetoptOption ߏ଄ମΛ࡞੒͠ɺσϦήʔτϝ ιουͰ౉͞Εͨ DDGetoptLongParser Πϯελ ϯεʹ addOptionsFromTable: Ͱ౉͢ 13೥6݄1೔౔༵೔
  5. DDGetoptOption - (void)application:(DDCliApplication *)app willParseOptions:(DDGetoptLongParser *)optionsParser; { DDGetoptOption optionTable[] =

    { // Long Short Argument options {@"version", 'v', DDGetoptNoArgument}, {@"help", 'h', DDGetoptNoArgument}, {@"output", 'o', DDGetoptRequiredArgument}, {@"filter-key", 'k', DDGetoptRequiredArgument}, {nil, 0, 0}, }; [optionsParser addOptionsFromTable: optionTable]; } 13೥6݄1೔౔༵೔
  6. Pandoc ͬͯʁ •Pandoc a universal document converter • ଟ༷ͳςΩετϑΥʔϚοτΛผͷϑΥʔϚοτʹม׵ •

    ରԠϑΥʔϚοτྫ • markdown • reStructuredText • textile • MediaWiki • ODT • docx • ͦͷଞ͍Ζ͍Ζ 13೥6݄1೔౔༵೔