[{"data":1,"prerenderedAt":292},["ShallowReactive",2],{"project-28886328":3},{"id":4,"name":5,"line":6,"line_source":7,"title":8,"url":9,"domain":10,"maker":11,"posted_at":12,"year":13,"points":14,"comments":15,"rank_in_year":16,"shown_in_year":17,"top":18,"tier":19,"category":20,"subcategory":21,"format":22,"keywords":23,"reception":28,"sentiment":29,"stance_mix":30,"scored_comments":35,"aspects":36,"strip":43,"post_text":45,"what":46,"said":74,"maker_in_thread":132,"shape":141,"grid":145,"attempts":253,"same_week":254,"maker_shows":31,"maker_hidden":284,"reader_version":285,"card":286},"28886328","command-interface","Add a command-line interface to any C++ program","title","Show HN: Add a command-line interface to any C++ program","https:\u002F\u002Fgithub.com\u002Fempirical-soft\u002Fcommand-interface","github.com","chrisaycock",1634372012,2021,119,40,435,2533,18,"notable","languages","c++ library","library",[24,25,26,27],"c++","repl","command interface","header library","curious",-0.069,{"positive":31,"neutral":32,"mixed":33,"critical":34},2,10,0,3,15,{"design":37,"performance":38,"idea":39,"docs":40,"execution":41},{"positive":31,"critical":33},{"positive":33,"critical":33},{"positive":33,"critical":33},{"positive":33,"critical":31},{"positive":33,"critical":42},1,[33,44,33,34,33,33,33,33,34,33,33,33,33,33,33,33,33,33,33,33,33,34,34,33,33,34,42,34,33,44,33,34,42,34,34,34,33,42,33,33],5,null,{"problem":47,"audience":54,"pricing":45,"motivation":63,"time_to_build":45,"stack":67,"openness":72,"stage":73,"team_size":73},{"value":48,"source":49,"evidence":50},"Adds a REPL-like interface to existing C++ programs to call functions from text input.","maker",[51],{"id":52,"by":11,"text":53},"28886331","I wrote this to add a REPL-like interface to existing programs. It can call normal functions with automatic parsing and type safety. ``` class Arithmetic : public…",{"value":55,"source":56,"evidence":57},"C++ developers who want a runtime command interface for their programs.","inferred",[58,59],{"id":52,"by":11,"text":53},{"id":60,"by":61,"text":62},"28887052","eps","Clean and simple API, clever implementation. Very nicely done. Saying as someone who worked on a cli framework for network devices in the past and quite enjoyed it. It was in C…",{"value":64,"source":49,"evidence":65},"Maker wanted to add a REPL-like interface to existing programs, and uses it to query and change a trading strategy's state over TCP.",[66],{"id":52,"by":11,"text":53},[68],{"value":69,"source":49,"evidence":70},"C++",[71],{"id":52,"by":11,"text":53},"open_source","unknown",{"praise":75,"objections":85,"requests":97,"questions":98,"alternatives":110},[76],{"value":77,"source":78,"evidence":79},"Clean, simple API and clever implementation.","commenter",[80,81],{"id":60,"by":61,"text":62},{"id":82,"by":83,"text":84},"28887230","choeger","Nice work. Thanks for releasing it as free software. If I understand the design correctly, one can provide a custom argument parser by specializing lexical_cast?",[86],{"value":87,"source":78,"evidence":88},"Title says command-line interface but it is a REPL.",[89,93],{"id":90,"by":91,"text":92},"28890622","butwhywhyoh","This isn't a command-line interface, this is a REPL. Very confusing title.",{"id":94,"by":95,"text":96},"28889324","ryandrake","Yea, I was a little confused by the \"command line\" claim, too. Like, where is it parsing argv and argc, and does it support long style and short style options? Title should say…",[],[99,103],{"value":100,"source":78,"evidence":101},"Can custom argument parsing be added by specializing lexical_cast?",[102],{"id":82,"by":83,"text":84},{"value":104,"source":78,"evidence":105},"How does it compare to boost::spirit?",[106],{"id":107,"by":108,"text":109},"28887912","ulnarkressty","How does this compare to boost::spirit? I tried some years ago to make something similar but gave up due to the huge compile times for even simple grammar parsing.",[111,118,125],{"value":112,"source":78,"evidence":113},"cpp-readline",[114],{"id":115,"by":116,"text":117},"28887331","svalorzen","Nice work! I maintain a library, cpp-readline [1], with a very similar API. The main difference is that relegates the REPL part to GNU readline. You do have the additional…",{"value":119,"source":78,"evidence":120},"Boost Program_options",[121],{"id":122,"by":123,"text":124},"28886500","nuerow","Obligatory reference to Boost's Program_options , which is as close to a standard way to handle command line options in C++ there is.…",{"value":126,"source":78,"evidence":127},"cling\u002FROOT",[128],{"id":129,"by":130,"text":131},"28894205","cozzyd","Note that you can use cling\u002FROOT an actual C++ repl.",{"comments":34,"answered":31,"key":133},[134,135,138],{"id":52,"text":53},{"id":136,"text":137},"28887696","Yes, in theory. I've never tried to specialize lexical_cast since it's a Boost library and likely has its own assumptions. But I imagine it's possible if you want to handle…",{"id":139,"text":140},"28887955","Spirit is a parser combinator. That's if you want to design a whole language from scratch. My library is for single-name commands that can take simple parameters. You can't…",{"commenters":142,"max_depth":143,"maker_replies":34,"first_comment_mins":33,"lifespan_hours":144},32,9,98,[146,148,150,152,155,159,162,166,168,172,175,178,180,184,187,190,193,195,198,200,203,206,209,211,214,217,219,221,223,224,225,229,232,233,235,237,240,243,247,251],[52,33,33,147,11,42],"project\u002Fneutral\u002Fnone",[82,33,44,149,83,33],"project\u002Fpositive\u002Fdesign",[136,33,33,151,11,42],"project\u002Fneutral\u002Fdesign",[153,33,34,151,154,33],"28888294","gpderetta",[156,33,33,157,158,33],"28887391","other\u002Fneutral\u002Fnone","agumonkey",[160,33,33,157,161,33],"28890482","dmalecaut",[163,33,33,164,165,33],"28895904","commenter\u002Fneutral\u002Fnone","sfgweilr4f",[167,33,33,164,161,33],"28928979",[169,42,34,170,171,33],"28886772","project\u002Fneutral\u002Fperformance","HMH",[173,42,33,157,174,33],"28886818","pjmlp",[176,42,33,157,177,33],"28886970","twqas",[179,42,33,157,174,33],"28887049",[181,42,33,182,183,33],"28889266","other\u002Fneutral\u002Fprivacy","inetknght",[185,42,33,157,186,33],"28889429","ranger_danger",[188,42,33,164,189,33],"28891862","kjs3",[191,42,33,164,192,33],"28892204","TillE",[194,42,33,164,189,33],"28926354",[196,42,33,157,197,33],"28887044","jstimpfle",[199,42,33,157,174,33],"28887063",[201,42,33,157,202,33],"28890602","moonchrome",[204,42,33,157,205,33],"28887868","ngneer",[207,42,34,170,208,33],"28886851","mrich",[210,42,34,170,186,33],"28889411",[212,42,33,157,213,33],"28889860","corysama",[215,42,33,157,216,33],"28890303","electroly",[115,31,34,218,116,33],"project\u002Fneutral\u002Fidea",[90,34,42,220,91,33],"project\u002Fcritical\u002Fdocs",[107,222,34,218,108,33],4,[139,222,33,218,11,42],[60,44,44,149,61,33],[226,227,33,157,228,33],"28887033",6,"azalemeth",[230,227,34,218,231,33],"28887155","jcul",[94,227,42,220,95,33],[129,234,34,218,130,33],7,[122,236,34,218,123,33],8,[238,236,34,147,239,33],"28886732","nly",[241,143,33,164,242,33],"28886571","anon-user-101",[244,32,42,245,246,33],"28886987","project\u002Fcritical\u002Fexecution","jb1991",[248,32,33,249,250,33],"28887025","commenter\u002Fpositive\u002Fnone","jkrubin",[252,32,33,164,61,33],"28887066",[],[255,260,265,270,275,279],{"id":256,"name":257,"points":258,"category":259},"28901214","SurfSonar",332,"hardware",{"id":261,"name":262,"points":263,"category":264},"28910368","dstream",217,"consumer_social",{"id":266,"name":267,"points":268,"category":269},"28868382","OtterTune",164,"infrastructure",{"id":271,"name":272,"points":273,"category":274},"28918850","Datree (YC W20)",144,"dev_tools",{"id":276,"name":277,"points":278,"category":269},"28900125","Qvm-Create-Windows-Qube",120,{"id":280,"name":281,"points":282,"category":283},"28895897","Vizzu",115,"data",false,"v2",{"id":287,"name":5,"line":6,"ai":284,"cat":20,"year":13,"points":14,"comments":15,"rec":28,"s":288,"top":18,"kw":289,"maker":11,"domain":10,"tier":19,"attempts":33,"strip":290,"url":9,"mix":291,"praise":77,"objection":87,"sub":21},28886328,-0.07,[24,25,26,27],"0503000030000000000003300313050313330100",[31,32,33,34],1794036612228]