{"id":387192,"date":"2024-06-29T07:11:02","date_gmt":"2024-06-29T07:11:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=387192"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=387192","title":{"rendered":"<span>\u041a\u0430\u043a \u044f \u0440\u0430\u0431\u043e\u0442\u0430\u044e \u0441 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u043e\u0439<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! \u041c\u043d\u043e\u0433\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438\u0441\u044c \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u044b\u043c\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c\u0438 (\u0442\u043e\u0442 \u0436\u0435 git). \u041d\u0435\u0434\u0430\u0432\u043d\u043e \u0440\u0435\u0448\u0438\u043b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0432\u043e\u0435 \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0440\u043e\u0443\u0442\u0435\u0440\u043e\u043c. \u041f\u043e \u0432\u0441\u0435\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c, \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043b \u044f\u0434\u0440\u043e, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u0435 \u0431\u0438\u0437\u043d\u0435\u0441 \u043b\u043e\u0433\u0438\u043a\u0443, \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0442\u0435\u0441\u0442\u044b \u0438 \u0437\u0430\u0442\u0435\u043c \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043b \u043a \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044e \u0431\u0438\u0437\u043d\u0435\u0441 \u043b\u043e\u0433\u0438\u043a\u0438 \u0441 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c. \u0412\u0441\u0435 \u0448\u043b\u043e \u0445\u043e\u0440\u043e\u0448\u043e, \u0434\u043e \u0442\u043e\u0433\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u043a\u0430\u043a \u043c\u043d\u0435 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u043b\u043e\u0441\u044c \u043f\u0430\u0440\u0441\u0438\u0442\u044c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438. \u0412 \u044d\u0442\u043e\u043c \u043f\u043e\u0441\u0442\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043a\u0430\u043a \u044f \u0440\u0435\u0448\u0438\u043b \u044d\u0442\u0443 \u0437\u0430\u0434\u0430\u0447\u0443.<\/p>\n<h2>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0412 \u043e\u0431\u0449\u0438\u0445 \u0447\u0435\u0440\u0442\u0430\u0445 \u0437\u0430\u0434\u0430\u0447\u0430 \u0441\u043e\u0441\u0442\u043e\u044f\u043b\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f:<\/p>\n<ol>\n<li>\n<p>\u0421\u043f\u0430\u0440\u0441\u0438\u0442\u044c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u043f\u043e\u0434\u0430\u043d\u044b\u0435 \u043d\u0430 \u0432\u0445\u043e\u0434.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u043d\u044f\u0442\u044c, \u0447\u0442\u043e \u0445\u043e\u0447\u0435\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c.<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443.<\/p>\n<\/li>\n<\/ol>\n<p>\u0412 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u043b \u043a \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430\u043c. \u0411\u0443\u0434\u0443 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0445\u0440\u043e\u043d\u043e\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438.<\/p>\n<h2>\u041d\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431<\/h2>\n<p>\u041f\u0435\u0440\u0432\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 &#8212; \u0432 \u043b\u043e\u0431. \u0412 .NET \u043d\u0430\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0443\u0436\u0435 \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 <code>static void Main(string[] args)<\/code>.<\/p>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0442\u0435\u0440\u0438\u0440\u0443\u0435\u043c\u0441\u044f \u043f\u043e \u044d\u0442\u043e\u043c\u0443 \u043c\u0430\u0441\u0441\u0438\u0432\u0443 \u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443. \u0417\u0432\u0443\u0447\u0438\u0442 \u043f\u0440\u043e\u0441\u0442\u043e. \u0421\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0442 \u043a\u043e\u0433\u0434\u0430:<\/p>\n<ol>\n<li>\n<p>\u041f\u043e\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u043a\u043b\u044e\u0447-\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u043b\u0438 \u0444\u043b\u0430\u0433\u0438 <code>--verbose<\/code> <code>grep -i 'hello, world!'<\/code> . <\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u043c\u0430\u043d\u0434\u044b \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435 ( \u043d\u0443\u0436\u043d\u043e \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u044c <code>git remote add<\/code> ).<\/p>\n<\/li>\n<li>\n<p>\u041d\u0443\u0436\u043d\u043e \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043a\u043e\u0434: \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0431\u0438\u0437\u043d\u0435\u0441 \u043b\u043e\u0433\u0438\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0430 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u0432 \u043a\u043b\u0430\u0441\u0441\u0435, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c <code>Main<\/code> \u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f. <\/p>\n<\/li>\n<\/ol>\n<p>\u041d\u043e \u044d\u0442\u043e \u043d\u0435 \u0437\u043d\u0430\u0447\u0438\u0442 \u0447\u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0435 \u0434\u043e\u0441\u0442\u043e\u0439\u043d\u043e \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043d\u0438\u044f. \u041e\u043d\u043e \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e \u0435\u0441\u043b\u0438:<\/p>\n<ol>\n<li>\n<p>\u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u043e\u0434\u043d\u043e\u0440\u043e\u0434\u043d\u044b. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043b\u0435\u0433\u043a\u0438\u0439 \u043a\u043b\u043e\u043d <code>mv<\/code> &#8212; \u0432\u0441\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b, \u043a\u0440\u043e\u043c\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u0444\u0430\u0439\u043b\u044b \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u044f, \u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 &#8212; \u043c\u0435\u0441\u0442\u043e \u043a\u0443\u0434\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0435\u043c.<\/p>\n<\/li>\n<li>\n<p>\u0414\u0435\u043b\u0430\u0435\u043c MVP. \u041d\u0430\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u0445\u0430\u0440\u0434\u043a\u043e\u0434\u0438\u0442\u044c 1-2 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e proof of concept*.<\/p>\n<\/li>\n<\/ol>\n<p>* \u042d\u0442\u043e\u0442 \u043f\u043e\u0434\u0445\u043e\u0434 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0432 \u0441\u0430\u043c\u043e\u043c \u043d\u0430\u0447\u0430\u043b\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u0435\u0442-\u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0438 \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u043d\u044f\u043b, \u0447\u0442\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0447\u0435\u0435 &#8212; \u043c\u043e\u044f \u043c\u043e\u0442\u0438\u0432\u0430\u0446\u0438\u044f \u043f\u043e\u0432\u044b\u0441\u0438\u043b\u0430\u0441\u044c (\u044d\u0442\u043e \u0442\u043e\u0436\u0435 \u043f\u043b\u044e\u0441).<\/p>\n<p>\u041d\u043e \u0441 \u0440\u043e\u0441\u0442\u043e\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438 \u0432\u044b\u0448\u0435 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0445 \u0442\u0440\u0443\u0434\u043d\u043e\u0441\u0442\u0435\u0439 \u044f \u043d\u0430\u0447\u0430\u043b \u0438\u0441\u043a\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u0443\u0442\u0438 \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430 \u0438 \u043f\u0440\u0438\u0448\u0435\u043b \u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0443.<\/p>\n<h2>\u0413\u043e\u0442\u043e\u0432\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430<\/h2>\n<p>\u042f \u0440\u0435\u0448\u0438\u043b \u043d\u0435 \u0438\u0437\u043e\u0431\u0440\u0435\u0442\u0430\u0442\u044c \u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434 \u0438 \u043d\u0430\u0439\u0442\u0438 \u0433\u043e\u0442\u043e\u0432\u044b\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f. \u0412 \u044d\u043a\u043e\u0441\u0438\u0441\u0442\u0435\u043c\u0435 .NET \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 <a href=\"https:\/\/github.com\/commandlineparser\/commandline\" rel=\"noopener noreferrer nofollow\">CommandLineParser<\/a>. \u0412\u0435\u0434\u0435\u0442 \u0438\u0441\u0442\u043e\u0440\u0438\u044e, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 2006 \u0433\u043e\u0434\u0430. \u0420\u0435\u0448\u0438\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0435. \u0415\u0435 \u0434\u043e\u0441\u0442\u043e\u0438\u043d\u0441\u0442\u0432\u0430\u043c\u0438 \u0441\u0447\u0438\u0442\u0430\u044e:<\/p>\n<ol>\n<li>\n<p>\u0414\u0435\u043a\u043b\u0430\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 (\u0410\u0442\u0440\u0438\u0431\u0443\u0442\u044b Verb, Option).<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u043c\u043e\u0449\u0438 (Help Text, Usage).<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0445 <code>(-v)<\/code> \u0438 \u0434\u043b\u0438\u043d\u043d\u044b\u0445 <code>(--verbose)<\/code>  \u043e\u043f\u0446\u0438\u0439.<\/p>\n<\/li>\n<li>\n<p>\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043a\u043e\u043d\u0432\u0435\u0440\u0438\u0442\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0438\u043f\u043e\u0432 \u043e\u043f\u0446\u0438\u0439 (IEnumerable, bool, string &#8230;).<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 C#, \u043d\u043e \u0438 F#, VB.<\/p>\n<\/li>\n<\/ol>\n<p>\u042d\u0442\u043e \u043c\u0430\u043b\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0435\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439. \u0411\u043e\u043b\u044c\u0448\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0432 \u0435\u0435 <a href=\"https:\/\/github.com\/commandlineparser\/commandline\/blob\/master\/README.md\" rel=\"noopener noreferrer nofollow\">README.md<\/a>. <\/p>\n<p>\u0412\u0441\u0435 \u0448\u043b\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u0432\u043f\u043b\u043e\u0442\u044c \u0434\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430. \u0412\u044b\u0448\u0435 \u044f \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u043b \u043a\u043e\u043c\u0430\u043d\u0434\u0443 <code>git remote add<\/code> . \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, CommandLineParser \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u043a\u043e\u043c\u0430\u043d\u0434. (\u041c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0441\u0442\u044b\u043b\u0438 \u043f\u043e \u0442\u0438\u043f\u0443 <code>git remote-add<\/code> \u0438\u043b\u0438 <code>git \"remote add\"<\/code>, \u043d\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c, \u043d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434).<\/p>\n<p>\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u043b \u0438\u0441\u043a\u0430\u0442\u044c \u0434\u0430\u043b\u044c\u0448\u0435, \u043d\u043e \u043d\u0435 \u043d\u0430\u0448\u0435\u043b \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0435\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 (\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043a\u0430\u043b \u043f\u043b\u043e\u0445\u043e). \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043f\u0440\u0438\u0448\u0435\u043b \u043a \u0432\u044b\u0432\u043e\u0434\u0443, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0441\u0430\u043c\u043e\u043c\u0443.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/595\/849\/96e\/59584996ef655c0a117440e08be894bb.jpg\" alt=\"\u041a\/\u0424 &quot;\u041f\u044f\u0442\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442&quot;\" title=\"\u041a\/\u0424 &quot;\u041f\u044f\u0442\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442&quot;\" width=\"790\" height=\"527\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/595\/849\/96e\/59584996ef655c0a117440e08be894bb.jpg\" data-blurred=\"true\"\/><figcaption>\u041a\/\u0424 &#171;\u041f\u044f\u0442\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442&#187;<\/figcaption><\/figure>\n<h2>\u0421\u0432\u043e\u0439 \u043f\u0430\u0440\u0441\u0435\u0440<\/h2>\n<p>\u042f \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043b \u043a \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e <s>\u0441\u0432\u043e\u0435\u0433\u043e \u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434\u0430<\/s> \u043f\u0430\u0440\u0441\u0435\u0440\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c, \u0432 \u043a\u0430\u043a\u043e\u043c \u0432\u0438\u0434\u0435 \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u044e\u0442 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u043d\u0430 \u0432\u0445\u043e\u0434. <\/p>\n<p>\u0412 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u043b\u043e \u0442\u0430\u043a: <code>COMMAND [OPTION]...<\/code> . \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u0434\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430 (\u0441\u043b\u043e\u0432\u0430 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u0431\u0435\u043b\u043e\u043c), \u0430 \u0437\u0430\u0442\u0435\u043c \u0438\u0434\u0443\u0442 \u043e\u043f\u0446\u0438\u0438 (\u043f\u0430\u0440\u044b \u043a\u043b\u044e\u0447-\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u043f\u0440\u0438\u0447\u0435\u043c \u043a\u043b\u044e\u0447 \u0438\u043c\u0435\u0435\u0442 \u043f\u0440\u0435\u0444\u0438\u043a\u0441 <code>--<\/code> ). \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0431\u044a\u0435\u043a\u0442 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u0441\u0430\u043c\u0443 \u043a\u043e\u043c\u0430\u043d\u0434\u0443.<\/p>\n<pre><code class=\"cs\">\/\/ CommandLineContext.cs using Router.Domain;  namespace Router.Commands;  public record CommandLineContext(string[] Command, RouterParameters RouterParameters, IDictionary&lt;string, string> Arguments, OutputStyle OutputStyle) {     private int _currentCommandIndex = 0;     public string? CurrentCommand =>         _currentCommandIndex &lt; Command.Length             ? Command[_currentCommandIndex]             : null;      public string? NextCommand => _currentCommandIndex + 1 &lt; Command.Length                                       ? Command[_currentCommandIndex + 1]                                       : null;     public bool HasNextCommand => _currentCommandIndex &lt; Command.Length;          public bool MoveNext()     {         if (_currentCommandIndex + 1 >= Command.Length)         {             return false;         }          _currentCommandIndex++;         return true;     } }<\/code><\/pre>\n<p>\u0414\u043b\u044f \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b F# \u0438 \u043a\u043e\u0434 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043b\u0430\u043a\u043e\u043d\u0438\u0447\u043d\u044b\u043c:<\/p>\n<pre><code class=\"fsharp\">\/\/ CommandLineContextParser.fs module Router.Commands.Utils.CommandLineContextParser.CommandLineContextParser  open System.Net open Microsoft.FSharp.Collections open Router.Commands open Router.Domain  type ParsingError =     | ArgumentExpectedError of Argument: string     | IncorrectArgumentValueError of Argument: string * Actual: string     | DuplicatedArgumentError of Argument: string  type Arguments = Map&lt;string, string> type Command = string list  type CommandLineContextUnparsed =     { Command: Command       RouterParameters: RouterParameters       Arguments: Arguments       Output: OutputStyle       Rest: string list }  type ParsingPipe = CommandLineContextUnparsed -> Result&lt;CommandLineContextUnparsed, ParsingError>  let (>=>) func1 func2 x =     match (func1 x) with     | Ok s -> func2 s     | Error err -> Error err  type ParseCommand = ParsingPipe type ParseArguments = ParsingPipe  type ParseCommandLineContext = string list -> Result&lt;CommandLineContext, ParsingError>  let parseCommandFromCommandLineInput: ParseCommand =     (fun context ->         let rec parseCommandFromCommandLineInputRec             (result: CommandLineContextUnparsed)             : Result&lt;CommandLineContextUnparsed, ParsingError> =             match result.Rest with             | [] -> Ok result             | first :: rest when not (first.StartsWith '-') ->                 parseCommandFromCommandLineInputRec                     { result with                         Rest = rest                         Command = first :: result.Command }             | _ -> Ok result          parseCommandFromCommandLineInputRec context)  let normalizeArgumentName (arg: string) = arg[2..]  let parseArgumentsFromCommandsParsed: ParseArguments =     (fun context ->         let rec parseInner (ctx: CommandLineContextUnparsed) =             match ctx.Rest with             | [] -> Ok ctx             | [ arg ] -> Error(ParsingError.ArgumentExpectedError arg)             | argument :: value :: rest ->                 let normalized = normalizeArgumentName argument                 match Map.containsKey normalized ctx.Arguments with                 | true ->                     Error(ParsingError.DuplicatedArgumentError normalized)                 | false ->                     parseInner { ctx with Arguments = (Map.add normalized value ctx.Arguments)                                           Rest = rest }          parseInner context)  let (??>) =     fun option fallback ->         match option with         | None -> fallback         | Some x -> x  let fallback value defaultValue map =     (Map.tryFind value map) ??> defaultValue  let extractRouterParameters: ParsingPipe =     (fun ctx ->         let args = ctx.Arguments          let address = fallback \"address\" \"192.168.0.1\" args          let username = fallback \"username\" \"admin\" args          let password = fallback \"password\" \"admin\" args          match IPAddress.TryParse address with         | (true, ip) -> Ok { ctx with RouterParameters = RouterParameters(ip, username, password) }         | _ -> Error(ParsingError.IncorrectArgumentValueError(\"address\", address)))   let toUnparsedFromList (list: string list) : Result&lt;CommandLineContextUnparsed, ParsingError> =     Ok  { Rest = list           Command = List.empty           Arguments = Map.empty           RouterParameters = RouterParameters.Default           Output = OutputStyle.KeyValue}  let toCommandLineContext (unparsed: CommandLineContextUnparsed) : Result&lt;CommandLineContext, ParsingError> =     Ok(CommandLineContext(unparsed.Command                           |> List.rev                           |> List.toArray,                           unparsed.RouterParameters,                           unparsed.Arguments,                           unparsed.Output))  let outputArgumentName = \"output\"  let (|Json|Xml|KeyValue|Table|Invalid|) str =     match str with     | \"json\" ->  Json     | \"xml\" ->   Xml     | \"plain\" ->  KeyValue     | \"table\" -> Table     | _ -> Invalid  let toOutputStyle (outputString: string): Result&lt;OutputStyle, ParsingError> =     match outputString with     | Json -> Ok OutputStyle.Json     | Xml -> Ok OutputStyle.Xml     | KeyValue -> Ok OutputStyle.KeyValue     | Table -> Ok OutputStyle.Table     | _ -> Error (ParsingError.IncorrectArgumentValueError(outputArgumentName, outputString))  let extractOutputStyle: ParsingPipe =     (fun context ->         match Map.tryFind outputArgumentName context.Arguments with         | Some outputString -> match toOutputStyle outputString with                                 | Ok output -> Ok {context with Output = output}                                 | Error parsingError -> Error parsingError         | None -> Ok context                                  )  let parsingPipeline =     parseCommandFromCommandLineInput     >=> parseArgumentsFromCommandsParsed     >=> extractRouterParameters     >=> extractOutputStyle   let parseCommandLineContext: ParseCommandLineContext =     toUnparsedFromList     >=> parsingPipeline     >=> toCommandLineContext <\/code><\/pre>\n<pre><code class=\"fsharp\">\/\/ FSharpCommandLineParser.fs namespace Router.Commands.Utils  open System open Router.Commands open Router.Commands.Exceptions open Router.Commands.Utils.CommandLineContextParser.CommandLineContextParser  [&lt;CLSCompliant(true)>] type FSharpCommandLineParser() =     member this.ParseCommandLineContext(args: string []) : CommandLineContext =         match parseCommandLineContext (Array.toList args) with         | Ok context -> context         | Error err ->             match err with             | ArgumentExpectedError expected -> raise (ArgumentValueExpectedException(expected, args))             | IncorrectArgumentValueError (argument, actual) ->                 raise (IncorrectArgumentValueException(argument, actual, args))             | DuplicatedArgumentError argument -> raise (DuplicatedArgumentsException(argument, args))      interface ICommandLineContextParser with         member this.ParseCommandLineContext(args) = this.ParseCommandLineContext args <\/code><\/pre>\n<p>\u041d\u0443 \u0432\u043e\u0442 \u043c\u044b \u0441\u043f\u0430\u0440\u0441\u0438\u043b\u0438 \u043d\u0430\u0448\u0443 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443. \u041d\u043e \u0447\u0442\u043e \u0434\u0430\u043b\u044c\u0448\u0435? \u041a\u0430\u043a \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0427\u0422\u041e \u043d\u0430\u043c \u0434\u0435\u043b\u0430\u0442\u044c?<\/p>\n<h2>\u041c\u0430\u0442. \u0447\u0430\u0441\u0442\u044c<\/h2>\n<p>\u041f\u043e\u043c\u043d\u0438\u0442\u0435 \u043a\u0430\u043a \u044f \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u043b \u0441\u043b\u043e\u0432\u043e <strong>\u043a\u043e\u043c\u0430\u043d\u0434\u0430<\/strong> \u0438 <strong>\u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439<\/strong>? \u0422\u0430\u043a \u0432\u043e\u0442. \u042d\u0442\u043e \u0442\u0435 \u0441\u0430\u043c\u044b\u0435 <a href=\"https:\/\/www.ozon.ru\/product\/patterny-obektno-orientirovannogo-proektirovaniya-gamma-erih-helm-richard-174491298\/?sh=8zoMFdPQcg\" rel=\"noopener noreferrer nofollow\">\u043f\u0430\u0442\u0442\u0435\u0440\u043d\u044b \u043a\u043e\u043c\u0430\u043d\u0434\u044b 4-\u0445<\/a> \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435:<\/p>\n<ol>\n<li>\n<p>\u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 &#8212; \u043f\u0430\u0442\u0442\u0435\u0440\u043d <a href=\"https:\/\/refactoring.guru\/ru\/design-patterns\/command\" rel=\"noopener noreferrer nofollow\">Command<\/a>.<\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u043c\u0430\u043d\u0434\u044b \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u043c\u0438. \u0410 \u043a\u0430\u043a\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u044d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442? \u041f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e &#8212; \u0434\u0435\u0440\u0435\u0432\u043e. \u042d\u0442\u043e \u043f\u0430\u0442\u0442\u0435\u0440\u043d <a href=\"https:\/\/refactoring.guru\/ru\/design-patterns\/composite\" rel=\"noopener noreferrer nofollow\">Composite<\/a>.<\/p>\n<\/li>\n<li>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443, \u0437\u0434\u0435\u0441\u044c <em>\u043c\u043e\u0436\u0435\u0442<\/em> \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u0444\u0430\u0431\u0440\u0438\u043a\u0430 &#8212; \u043f\u0430\u0442\u0442\u0435\u0440\u043d <a href=\"https:\/\/refactoring.guru\/ru\/design-patterns\/abstract-factory\" rel=\"noopener noreferrer nofollow\">Abstract Factory<\/a>.<\/p>\n<\/li>\n<\/ol>\n<h2>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/h2>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0432\u0435\u0440\u0445\u0443-\u0432\u043d\u0438\u0437, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u0441 \u041a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u0449\u0438\u043a\u0430.<\/p>\n<h4>\u041a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u0449\u0438\u043a<\/h4>\n<p>\u041d\u0430\u0448\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0438\u043c\u0435\u044e\u0442 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0434\u0435\u0440\u0435\u0432\u0430 (\u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0447\u0435\u0441\u043a\u0443\u044e):<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/0f7\/0af\/8c1\/0f70af8c18d5d0186c4cc0011f40800c.png\" alt=\"'git' - \u043d\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0432 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b, \u0442.\u043a. \u044d\u0442\u043e \u0441\u0430\u043c\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430\" title=\"'git' - \u043d\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0432 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b, \u0442.\u043a. \u044d\u0442\u043e \u0441\u0430\u043c\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430\" width=\"883\" height=\"771\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/0f7\/0af\/8c1\/0f70af8c18d5d0186c4cc0011f40800c.png\"\/><figcaption>&#8216;git&#8217; &#8212; \u043d\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0432 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b, \u0442.\u043a. \u044d\u0442\u043e \u0441\u0430\u043c\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430<\/figcaption><\/figure>\n<p>\u0412\u044b\u0434\u0435\u043b\u0438\u043c \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0439 \u0443\u0437\u0435\u043b \u0438 \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u043c \u043e\u0442 \u043d\u0435\u0433\u043e 2 \u0434\u0440\u0443\u0433\u0438\u0445 &#8212; \u043b\u0438\u0441\u0442 \u0438 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u0443\u0437\u0435\u043b:<\/p>\n<pre><code class=\"cs\">\/\/ InternalTpLinkCommandFactory.cs internal abstract class InternalTpLinkCommandFactory : IRouterCommandFactory {     public string Name { get; }      public InternalTpLinkCommandFactory(string name)     {         ArgumentNullException.ThrowIfNull(name);         Name = name;     }     public abstract IRouterCommand CreateRouterCommand(RouterCommandContext context); }<\/code><\/pre>\n<pre><code class=\"cs\">\/\/ SingleTpLinkCommandFactory.cs internal abstract class SingleTpLinkCommandFactory : InternalTpLinkCommandFactory {     protected SingleTpLinkCommandFactory(string name) : base(name) { } }<\/code><\/pre>\n<pre><code class=\"cs\">using Router.Commands; using Router.Commands.Exceptions;  namespace Router.TpLink.CommandFactories;  internal abstract class CompositeTpLinkCommandFactory : InternalTpLinkCommandFactory {     protected Dictionary&lt;string, InternalTpLinkCommandFactory> Commands { get; }      protected CompositeTpLinkCommandFactory(IEnumerable&lt;InternalTpLinkCommandFactory> commands, string rootName)         : base(rootName)     {         ArgumentNullException.ThrowIfNull(commands);         Commands = commands.ToDictionary(c => c.Name);     }      public override IRouterCommand CreateRouterCommand(RouterCommandContext context)     {         var currentCommand = context.CurrentCommand;         if (currentCommand is null || !Commands.TryGetValue(currentCommand, out var factory))             throw new UnknownCommandException(currentCommand, context.Command.ToArray());         context.MoveNext();         return factory.CreateRouterCommand(context);      } }<\/code><\/pre>\n<h4>\u0410\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u0430\u044f \u0444\u0430\u0431\u0440\u0438\u043a\u0430<\/h4>\n<p>\u041d\u0430\u0448\u0438 \u043b\u0438\u0441\u0442\u044c\u044f &#8212; \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0435 \u0442\u043e\u0447\u043a\u0438 (\u043f\u043e\u0447\u0442\u0438 \u0442\u0430\u043a\u0438\u0435 \u0436\u0435 \u043a\u0430\u043a \u0438 \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435). \u041a\u0430\u0436\u0434\u044b\u0439 \u043b\u0438\u0441\u0442 &#8212; \u043f\u043e\u0440\u043e\u0436\u0434\u0430\u0435\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u0443. \u0412 \u043c\u043e\u0435\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u043b \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0438\u0437 \u041a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u0449\u0438\u043a\u0430, \u0442.\u0435. \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u043b \u0424\u0430\u0431\u0440\u0438\u043a\u0443 \u0438 \u041a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u0449\u0438\u043a\u0430. \u042d\u0442\u043e \u043d\u0430\u0440\u0443\u0448\u0435\u0442 \u043f\u0440\u0438\u043d\u0446\u0438\u043f \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u0438, \u0442\u0430\u043a \u043a\u0430\u043a \u0435\u0441\u043b\u0438:<\/p>\n<ol>\n<li>\n<p>\u041c\u044b \u0437\u0430\u0445\u043e\u0442\u0438\u043c \u0432\u0432\u0435\u0441\u0442\u0438 \u043f\u0441\u0435\u0432\u0434\u043e\u043d\u0438\u043c\u044b (aliases).<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0432 \u0440\u0430\u043d\u0442\u0430\u0439\u043c\u0435 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434.<\/p>\n<\/li>\n<\/ol>\n<p>\u0422\u043e \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043d\u0435\u0445\u0438\u043b\u043e \u043f\u043e\u043f\u043e\u0442\u0435\u0442\u044c \u0437\u0430\u043d\u0438\u043c\u0430\u044f\u0441\u044c \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433\u043e\u043c. \u041d\u043e \u044f \u043e\u0441\u043e\u0437\u043d\u0430\u044e, \u0447\u0442\u043e \u043f\u0440\u0435\u043d\u0435\u0431\u0440\u0435\u0433 Single Responsibility, \u0438 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e \u0432\u0441\u0435 \u0431\u0443\u0434\u0443\u0449\u0438\u0435 \u0442\u0440\u0443\u0434\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>\u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043b\u0438\u0441\u0442\u0430:<\/p>\n<pre><code class=\"cs\">\/\/ GetWlanStatusCommandFactory.cs \/\/ \u041f\u043e\u043b\u043d\u0430\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u043d\u0430 \u0432\u0445\u043e\u0434: \"wlan status\" using Router.Commands; using Router.TpLink.Commands;  namespace Router.TpLink.CommandFactories.Wlan;  internal class GetWlanStatusCommandFactory : SingleTpLinkCommandFactory {     public GetWlanStatusCommandFactory()          : base(\"status\")      { }     public override IRouterCommand CreateRouterCommand(RouterCommandContext context)     {         return new TpLinkGetWlanStatusCommand(Console.Out, context.Router, context.OutputFormatter);     } }<\/code><\/pre>\n<h4>\u041a\u043e\u043c\u0430\u043d\u0434\u0430<\/h4>\n<p>\u041c\u044b \u043f\u043e\u0434\u043e\u0448\u043b\u0438 \u043a \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u044e\u0449\u0435\u043c\u0443 \u044d\u0442\u0430\u043f\u0443 &#8212; \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0430. \u0417\u0430 \u0435\u0435 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 <code>IRouterCommand<\/code> , \u043a\u043e\u0442\u043e\u0440\u044b\u0439, \u043a\u0430\u043a \u0432\u044b \u043c\u043e\u0433\u043b\u0438 \u0434\u043e\u0433\u0430\u0434\u0430\u0442\u044c\u0441\u044f, \u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u043e\u043c \u041a\u043e\u043c\u0430\u043d\u0434\u0430.<\/p>\n<pre><code class=\"cs\">namespace Router.Commands;  public interface IRouterCommand {     public Task ExecuteAsync(); }<\/code><\/pre>\n<p>\u0412\u044b \u0443\u0436\u0435 \u0443\u0432\u0438\u0434\u0435\u043b\u0438, \u0447\u0442\u043e \u0444\u0430\u0431\u0440\u0438\u043a\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0442 \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 <code>IRouterCommandFactory<\/code> . \u0410 \u0432\u043e\u0442 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0438 \u043e\u043d.<\/p>\n<pre><code class=\"cs\">\/\/ IRouterCommandFactory.cs using Router.Commands;  namespace Router.TpLink;  internal interface IRouterCommandFactory {     IRouterCommand CreateRouterCommand(RouterCommandContext context); }<\/code><\/pre>\n<p>\u041a\u043e\u043c\u0430\u043d\u0434\u044b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043b\u0438\u0441\u0442\u044b, \u0443\u0437\u043b\u044b &#8212; \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442. <\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u043b\u0438\u0441\u0442\u0430.<\/p>\n<pre><code class=\"cs\">\/\/ GetWlanStatusCommandFactory.cs using Router.Commands; using Router.TpLink.Commands;  namespace Router.TpLink.CommandFactories.Wlan;  internal class GetWlanStatusCommandFactory : SingleTpLinkCommandFactory {     public GetWlanStatusCommandFactory()          : base(\"status\")      { }     public override IRouterCommand CreateRouterCommand(RouterCommandContext context)     {         return new TpLinkGetWlanStatusCommand(Console.Out, context.Router, context.OutputFormatter);     } }<\/code><\/pre>\n<p>\u0418 \u0441\u0430\u043c\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b:<\/p>\n<pre><code class=\"cs\">\/\/ TpLinkGetWlanStatusCommand.cs using Router.Commands; using Router.TpLink.Commands.DTO;  namespace Router.TpLink.Commands;  public class TpLinkGetWlanStatusCommand : TpLinkBaseCommand {     private readonly IOutputFormatter _formatter;     private readonly TextWriter _output;          public TpLinkGetWlanStatusCommand(TextWriter output, TpLinkRouter router, IOutputFormatter formatter)          : base(router)     {         _formatter = formatter;         _output = output;     }          public override async Task ExecuteAsync()     {         var wlan = await Router.Wlan.GetStatusAsync();         var display = new WlanDisplayStatus(wlan.Password, wlan.SSID, wlan.IsActive);         var result = _formatter.Format(display);         await _output.WriteLineAsync(result);     } }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u043c \u0432\u0441\u0435 \u0432\u043c\u0435\u0441\u0442\u0435:<\/p>\n<pre><code class=\"cs\">\/\/ RouterApplication.cs using Router.Commands;  namespace TpLinkConsole.Infrastructure;  public class RouterApplication : IApplication {     private readonly ICommandLineContextParser _parser;     private readonly IRouterCommandFactory _factory;      public RouterApplication(ICommandLineContextParser parser, IRouterCommandFactory factory)     {         _parser = parser;         _factory = factory;     }      public async Task RunAsync(string[] args)     {         var context = _parser.ParseCommandLineContext(args);         var command = _factory.CreateRouterCommand(context);         await command.ExecuteAsync();     } }<\/code><\/pre>\n<h2>\u0418\u0442\u043e\u0433\u0438<\/h2>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0432\u044b\u0432\u043e\u0434\u044b:<\/p>\n<ol>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u043e\u0434\u043d\u043e\u0440\u043e\u0434\u043d\u044b &#8212; \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0442\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u043e \u0432\u0445\u043e\u0434\u043d\u043e\u043c\u0443 \u043c\u0430\u0441\u0441\u0438\u0432\u0443. \u041d\u0435 \u043d\u0443\u0436\u043d\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0435 \u0438\u0437\u043e\u0431\u0440\u0435\u0442\u0430\u0439\u0442\u0435 \u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434 \u0431\u0435\u0437 \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438. \u0423\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0433\u043e\u0442\u043e\u0432\u044b\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f &#8212; \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u0438\u0445.<\/p>\n<\/li>\n<li>\n<p>\u041c\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0435\u0449\u0435 \u0440\u0430\u0437 \u0434\u043e\u043a\u0430\u0437\u0430\u043b\u043e, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u0436\u043d\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043b\u043e\u0433\u0438\u043a\u0438 \u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p>\u0411\u0443\u0434\u044c\u0442\u0435 \u0433\u043e\u0442\u043e\u0432\u044b \u0438\u0437\u043e\u0431\u0440\u0435\u0442\u0430\u0442\u044c \u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434, \u0440\u0435\u0448\u0438\u0432\u0448\u0438\u0441\u044c \u0434\u0435\u043b\u0430\u0442\u044c \u0441\u0432\u043e\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430: \u0442\u0435\u043a\u0441\u0442 \u043f\u043e\u043c\u043e\u0449\u0438, \u043a\u0430\u0441\u0442\u043e\u0432\u0430\u043d\u0438\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u043a \u043d\u0443\u0436\u043d\u043e\u043c\u0443 \u0442\u0438\u043f\u0443 \u0438 \u0442.\u0434.<\/p>\n<\/li>\n<\/ol>\n<p>\u0410 \u043a\u0430\u043a \u0432\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442\u0435 \u0441 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438? \u041d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445.<\/p>\n<p>\u0417.\u042b. \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u043e <a href=\"https:\/\/github.com\/ashenBlade\/tpcon\" rel=\"noopener noreferrer nofollow\">\u0441\u0441\u044b\u043b\u043a\u0435<\/a><\/p>\n<p>\u0417.\u0417.\u042b \u0425\u0430\u0431\u0440, \u0434\u043e\u0431\u0430\u0432\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430 F#!!! (\u0421\u043f\u0430\u0441\u0438\u0431\u043e, \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438)<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/667438\/\"> https:\/\/habr.com\/ru\/articles\/667438\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! \u041c\u043d\u043e\u0433\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438\u0441\u044c \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u044b\u043c\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c\u0438 (\u0442\u043e\u0442 \u0436\u0435 git). \u041d\u0435\u0434\u0430\u0432\u043d\u043e \u0440\u0435\u0448\u0438\u043b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0432\u043e\u0435 \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0440\u043e\u0443\u0442\u0435\u0440\u043e\u043c. \u041f\u043e \u0432\u0441\u0435\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c, \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043b \u044f\u0434\u0440\u043e, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u0435 \u0431\u0438\u0437\u043d\u0435\u0441 \u043b\u043e\u0433\u0438\u043a\u0443, \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0442\u0435\u0441\u0442\u044b \u0438 \u0437\u0430\u0442\u0435\u043c \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043b \u043a \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044e \u0431\u0438\u0437\u043d\u0435\u0441 \u043b\u043e\u0433\u0438\u043a\u0438 \u0441 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c. \u0412\u0441\u0435 \u0448\u043b\u043e \u0445\u043e\u0440\u043e\u0448\u043e, \u0434\u043e \u0442\u043e\u0433\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u043a\u0430\u043a \u043c\u043d\u0435 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u043b\u043e\u0441\u044c \u043f\u0430\u0440\u0441\u0438\u0442\u044c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438. \u0412 \u044d\u0442\u043e\u043c \u043f\u043e\u0441\u0442\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043a\u0430\u043a \u044f \u0440\u0435\u0448\u0438\u043b \u044d\u0442\u0443 \u0437\u0430\u0434\u0430\u0447\u0443.<\/p>\n<h2>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0412 \u043e\u0431\u0449\u0438\u0445 \u0447\u0435\u0440\u0442\u0430\u0445 \u0437\u0430\u0434\u0430\u0447\u0430 \u0441\u043e\u0441\u0442\u043e\u044f\u043b\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f:<\/p>\n<ol>\n<li>\n<p>\u0421\u043f\u0430\u0440\u0441\u0438\u0442\u044c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u043f\u043e\u0434\u0430\u043d\u044b\u0435 \u043d\u0430 \u0432\u0445\u043e\u0434.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u043d\u044f\u0442\u044c, \u0447\u0442\u043e \u0445\u043e\u0447\u0435\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c.<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443.<\/p>\n<\/li>\n<\/ol>\n<p>\u0412 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u043b \u043a \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430\u043c. \u0411\u0443\u0434\u0443 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0445\u0440\u043e\u043d\u043e\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438.<\/p>\n<h2>\u041d\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431<\/h2>\n<p>\u041f\u0435\u0440\u0432\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 &#8212; \u0432 \u043b\u043e\u0431. \u0412 .NET \u043d\u0430\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0443\u0436\u0435 \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 <code>static void Main(string[] args)<\/code>.<\/p>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0442\u0435\u0440\u0438\u0440\u0443\u0435\u043c\u0441\u044f \u043f\u043e \u044d\u0442\u043e\u043c\u0443 \u043c\u0430\u0441\u0441\u0438\u0432\u0443 \u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443. \u0417\u0432\u0443\u0447\u0438\u0442 \u043f\u0440\u043e\u0441\u0442\u043e. \u0421\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0442 \u043a\u043e\u0433\u0434\u0430:<\/p>\n<ol>\n<li>\n<p>\u041f\u043e\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u043a\u043b\u044e\u0447-\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u043b\u0438 \u0444\u043b\u0430\u0433\u0438 <code>--verbose<\/code> <code>grep -i 'hello, world!'<\/code> . <\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u043c\u0430\u043d\u0434\u044b \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435 ( \u043d\u0443\u0436\u043d\u043e \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u044c <code>git remote add<\/code> ).<\/p>\n<\/li>\n<li>\n<p>\u041d\u0443\u0436\u043d\u043e \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043a\u043e\u0434: \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0431\u0438\u0437\u043d\u0435\u0441 \u043b\u043e\u0433\u0438\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0430 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u0432 \u043a\u043b\u0430\u0441\u0441\u0435, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c <code>Main<\/code> \u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f. <\/p>\n<\/li>\n<\/ol>\n<p>\u041d\u043e \u044d\u0442\u043e \u043d\u0435 \u0437\u043d\u0430\u0447\u0438\u0442 \u0447\u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0435 \u0434\u043e\u0441\u0442\u043e\u0439\u043d\u043e \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043d\u0438\u044f. \u041e\u043d\u043e \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e \u0435\u0441\u043b\u0438:<\/p>\n<ol>\n<li>\n<p>\u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u043e\u0434\u043d\u043e\u0440\u043e\u0434\u043d\u044b. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043b\u0435\u0433\u043a\u0438\u0439 \u043a\u043b\u043e\u043d <code>mv<\/code> &#8212; \u0432\u0441\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b, \u043a\u0440\u043e\u043c\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u0444\u0430\u0439\u043b\u044b \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u044f, \u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 &#8212; \u043c\u0435\u0441\u0442\u043e \u043a\u0443\u0434\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0435\u043c.<\/p>\n<\/li>\n<li>\n<p>\u0414\u0435\u043b\u0430\u0435\u043c MVP. \u041d\u0430\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u0445\u0430\u0440\u0434\u043a\u043e\u0434\u0438\u0442\u044c 1-2 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e proof of concept*.<\/p>\n<\/li>\n<\/ol>\n<p>* \u042d\u0442\u043e\u0442 \u043f\u043e\u0434\u0445\u043e\u0434 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0432 \u0441\u0430\u043c\u043e\u043c \u043d\u0430\u0447\u0430\u043b\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u0435\u0442-\u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0438 \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u043d\u044f\u043b, \u0447\u0442\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0447\u0435\u0435 &#8212; \u043c\u043e\u044f \u043c\u043e\u0442\u0438\u0432\u0430\u0446\u0438\u044f \u043f\u043e\u0432\u044b\u0441\u0438\u043b\u0430\u0441\u044c (\u044d\u0442\u043e \u0442\u043e\u0436\u0435 \u043f\u043b\u044e\u0441).<\/p>\n<p>\u041d\u043e \u0441 \u0440\u043e\u0441\u0442\u043e\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438 \u0432\u044b\u0448\u0435 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0445 \u0442\u0440\u0443\u0434\u043d\u043e\u0441\u0442\u0435\u0439 \u044f \u043d\u0430\u0447\u0430\u043b \u0438\u0441\u043a\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u0443\u0442\u0438 \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430 \u0438 \u043f\u0440\u0438\u0448\u0435\u043b \u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0443.<\/p>\n<h2>\u0413\u043e\u0442\u043e\u0432\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430<\/h2>\n<p>\u042f \u0440\u0435\u0448\u0438\u043b \u043d\u0435 \u0438\u0437\u043e\u0431\u0440\u0435\u0442\u0430\u0442\u044c \u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434 \u0438 \u043d\u0430\u0439\u0442\u0438 \u0433\u043e\u0442\u043e\u0432\u044b\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f. \u0412 \u044d\u043a\u043e\u0441\u0438\u0441\u0442\u0435\u043c\u0435 .NET \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 <a href=\"https:\/\/github.com\/commandlineparser\/commandline\" rel=\"noopener noreferrer nofollow\">CommandLineParser<\/a>. \u0412\u0435\u0434\u0435\u0442 \u0438\u0441\u0442\u043e\u0440\u0438\u044e, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 2006 \u0433\u043e\u0434\u0430. \u0420\u0435\u0448\u0438\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0435. \u0415\u0435 \u0434\u043e\u0441\u0442\u043e\u0438\u043d\u0441\u0442\u0432\u0430\u043c\u0438 \u0441\u0447\u0438\u0442\u0430\u044e:<\/p>\n<ol>\n<li>\n<p>\u0414\u0435\u043a\u043b\u0430\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 (\u0410\u0442\u0440\u0438\u0431\u0443\u0442\u044b Verb, Option).<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u043c\u043e\u0449\u0438 (Help Text, Usage).<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0445 <code>(-v)<\/code> \u0438 \u0434\u043b\u0438\u043d\u043d\u044b\u0445 <code>(--verbose)<\/code>  \u043e\u043f\u0446\u0438\u0439.<\/p>\n<\/li>\n<li>\n<p>\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043a\u043e\u043d\u0432\u0435\u0440\u0438\u0442\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0438\u043f\u043e\u0432 \u043e\u043f\u0446\u0438\u0439 (IEnumerable, bool, string &#8230;).<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 C#, \u043d\u043e \u0438 F#, VB.<\/p>\n<\/li>\n<\/ol>\n<p>\u042d\u0442\u043e \u043c\u0430\u043b\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0435\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439. \u0411\u043e\u043b\u044c\u0448\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0432 \u0435\u0435 <a href=\"https:\/\/github.com\/commandlineparser\/commandline\/blob\/master\/README.md\" rel=\"noopener noreferrer nofollow\">README.md<\/a>. <\/p>\n<p>\u0412\u0441\u0435 \u0448\u043b\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u0432\u043f\u043b\u043e\u0442\u044c \u0434\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430. \u0412\u044b\u0448\u0435 \u044f \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u043b \u043a\u043e\u043c\u0430\u043d\u0434\u0443 <code>git remote add<\/code> . \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, CommandLineParser \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u043a\u043e\u043c\u0430\u043d\u0434. (\u041c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0441\u0442\u044b\u043b\u0438 \u043f\u043e \u0442\u0438\u043f\u0443 <code>git remote-add<\/code> \u0438\u043b\u0438 <code>git \"remote add\"<\/code>, \u043d\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c, \u043d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434).<\/p>\n<p>\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u043b \u0438\u0441\u043a\u0430\u0442\u044c \u0434\u0430\u043b\u044c\u0448\u0435, \u043d\u043e \u043d\u0435 \u043d\u0430\u0448\u0435\u043b \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0435\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 (\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043a\u0430\u043b \u043f\u043b\u043e\u0445\u043e). \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043f\u0440\u0438\u0448\u0435\u043b \u043a \u0432\u044b\u0432\u043e\u0434\u0443, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0441\u0430\u043c\u043e\u043c\u0443.<\/p>\n<figure class=\"full-width\"><figcaption>\u041a\/\u0424 &#171;\u041f\u044f\u0442\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442&#187;<\/figcaption><\/figure>\n<h2>\u0421\u0432\u043e\u0439 \u043f\u0430\u0440\u0441\u0435\u0440<\/h2>\n<p>\u042f \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043b \u043a \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e <s>\u0441\u0432\u043e\u0435\u0433\u043e \u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434\u0430<\/s> \u043f\u0430\u0440\u0441\u0435\u0440\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c, \u0432 \u043a\u0430\u043a\u043e\u043c \u0432\u0438\u0434\u0435 \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u044e\u0442 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u043d\u0430 \u0432\u0445\u043e\u0434. <\/p>\n<p>\u0412 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u043b\u043e \u0442\u0430\u043a: <code>COMMAND [OPTION]...<\/code> . \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u0434\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430 (\u0441\u043b\u043e\u0432\u0430 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u0431\u0435\u043b\u043e\u043c), \u0430 \u0437\u0430\u0442\u0435\u043c \u0438\u0434\u0443\u0442 \u043e\u043f\u0446\u0438\u0438 (\u043f\u0430\u0440\u044b \u043a\u043b\u044e\u0447-\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u043f\u0440\u0438\u0447\u0435\u043c \u043a\u043b\u044e\u0447 \u0438\u043c\u0435\u0435\u0442 \u043f\u0440\u0435\u0444\u0438\u043a\u0441 <code>--<\/code> ). \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0431\u044a\u0435\u043a\u0442 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u0441\u0430\u043c\u0443 \u043a\u043e\u043c\u0430\u043d\u0434\u0443.<\/p>\n<pre><code class=\"cs\">\/\/ CommandLineContext.cs using Router.Domain;  namespace Router.Commands;  public record CommandLineContext(string[] Command, RouterParameters RouterParameters, IDictionary&lt;string, string> Arguments, OutputStyle OutputStyle) {     private int _currentCommandIndex = 0;     public string? CurrentCommand =>         _currentCommandIndex &lt; Command.Length             ? Command[_currentCommandIndex]             : null;      public string? NextCommand => _currentCommandIndex + 1 &lt; Command.Length                                       ? Command[_currentCommandIndex + 1]                                       : null;     public bool HasNextCommand => _currentCommandIndex &lt; Command.Length;          public bool MoveNext()     {         if (_currentCommandIndex + 1 >= Command.Length)         {             return false;         }          _currentCommandIndex++;         return true;     } }<\/code><\/pre>\n<p>\u0414\u043b\u044f \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b F# \u0438 \u043a\u043e\u0434 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043b\u0430\u043a\u043e\u043d\u0438\u0447\u043d\u044b\u043c:<\/p>\n<pre><code class=\"fsharp\">\/\/ CommandLineContextParser.fs module Router.Commands.Utils.CommandLineContextParser.CommandLineContextParser  open System.Net open Microsoft.FSharp.Collections open Router.Commands open Router.Domain  type ParsingError =     | ArgumentExpectedError of Argument: string     | IncorrectArgumentValueError of Argument: string * Actual: string     | DuplicatedArgumentError of Argument: string  type Arguments = Map&lt;string, string> type Command = string list  type CommandLineContextUnparsed =     { Command: Command       RouterParameters: RouterParameters       Arguments: Arguments       Output: OutputStyle       Rest: string list }  type ParsingPipe = CommandLineContextUnparsed -> Result&lt;CommandLineContextUnparsed, ParsingError>  let (>=>) func1 func2 x =     match (func1 x) with     | Ok s -> func2 s     | Error err -> Error err  type ParseCommand = ParsingPipe type ParseArguments = ParsingPipe  type ParseCommandLineContext = string list -> Result&lt;CommandLineContext, ParsingError>  let parseCommandFromCommandLineInput: ParseCommand =     (fun context ->         let rec parseCommandFromCommandLineInputRec             (result: CommandLineContextUnparsed)             : Result&lt;CommandLineContextUnparsed, ParsingError> =             match result.Rest with             | [] -> Ok result             | first :: rest when not (first.StartsWith '-') ->                 parseCommandFromCommandLineInputRec                     { result with                         Rest = rest                         Command = first :: result.Command }             | _ -> Ok result          parseCommandFromCommandLineInputRec context)  let normalizeArgumentName (arg: string) = arg[2..]  let parseArgumentsFromCommandsParsed: ParseArguments =     (fun context ->         let rec parseInner (ctx: CommandLineContextUnparsed) =             match ctx.Rest with             | [] -> Ok ctx             | [ arg ] -> Error(ParsingError.ArgumentExpectedError arg)             | argument :: value :: rest ->                 let normalized = normalizeArgumentName argument                 match Map.containsKey normalized ctx.Arguments with                 | true ->                     Error(ParsingError.DuplicatedArgumentError normalized)                 | false ->                     parseInner { ctx with Arguments = (Map.add normalized value ctx.Arguments)                                           Rest = rest }          parseInner context)  let (??>) =     fun option fallback ->         match option with         | None -> fallback         | Some x -> x  let fallback value defaultValue map =     (Map.tryFind value map) ??> defaultValue  let extractRouterParameters: ParsingPipe =     (fun ctx ->         let args = ctx.Arguments          let address = fallback \"address\" \"192.168.0.1\" args          let username = fallback \"username\" \"admin\" args          let password = fallback \"password\" \"admin\" args          match IPAddress.TryParse address with         | (true, ip) -> Ok { ctx with RouterParameters = RouterParameters(ip, username, password) }         | _ -> Error(ParsingError.IncorrectArgumentValueError(\"address\", address)))   let toUnparsedFromList (list: string list) : Result&lt;CommandLineContextUnparsed, ParsingError> =     Ok  { Rest = list           Command = List.empty           Arguments = Map.empty           RouterParameters = RouterParameters.Default           Output = OutputStyle.KeyValue}  let toCommandLineContext (unparsed: CommandLineContextUnparsed) : Result&lt;CommandLineContext, ParsingError> =     Ok(CommandLineContext(unparsed.Command                           |> List.rev                           |> List.toArray,                           unparsed.RouterParameters,                           unparsed.Arguments,                           unparsed.Output))  let outputArgumentName = \"output\"  let (|Json|Xml|KeyValue|Table|Invalid|) str =     match str with     | \"json\" ->  Json     | \"xml\" ->   Xml     | \"plain\" ->  KeyValue     | \"table\" -> Table     | _ -> Invalid  let toOutputStyle (outputString: string): Result&lt;OutputStyle, ParsingError> =     match outputString with     | Json -> Ok OutputStyle.Json     | Xml -> Ok OutputStyle.Xml     | KeyValue -> Ok OutputStyle.KeyValue     | Table -> Ok OutputStyle.Table     | _ -> Error (ParsingError.IncorrectArgumentValueError(outputArgumentName, outputString))  let extractOutputStyle: ParsingPipe =     (fun context ->         match Map.tryFind outputArgumentName context.Arguments with         | Some outputString -> match toOutputStyle outputString with                                 | Ok output -> Ok {context with Output = output}                                 | Error parsingError -> Error parsingError         | None -> Ok context                                  )  let parsingPipeline =     parseCommandFromCommandLineInput     >=> parseArgumentsFromCommandsParsed     >=> extractRouterParameters     >=> extractOutputStyle   let parseCommandLineContext: ParseCommandLineContext =     toUnparsedFromList     >=> parsingPipeline     >=> toCommandLineContext <\/code><\/pre>\n<pre><code class=\"fsharp\">\/\/ FSharpCommandLineParser.fs namespace Router.Commands.Utils  open System open Router.Commands open Router.Commands.Exceptions open Router.Commands.Utils.CommandLineContextParser.CommandLineContextParser  [&lt;CLSCompliant(true)>] type FSharpCommandLineParser() =     member this.ParseCommandLineContext(args: string []) : CommandLineContext =         match parseCommandLineContext (Array.toList args) with         | Ok context -> context         | Error err ->             match err with             | ArgumentExpectedError expected -> raise (ArgumentValueExpectedException(expected, args))             | IncorrectArgumentValueError (argument, actual) ->                 raise (IncorrectArgumentValueException(argument, actual, args))             | DuplicatedArgumentError argument -> raise (DuplicatedArgumentsException(argument, args))      interface<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-387192","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/387192","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=387192"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/387192\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=387192"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=387192"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=387192"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}