{"id":1180,"date":"2024-02-15T22:14:56","date_gmt":"2024-02-15T16:44:56","guid":{"rendered":"https:\/\/pune.wordcamp.org\/2024\/?post_type=wcb_session&#038;p=1180"},"modified":"2024-02-15T22:15:38","modified_gmt":"2024-02-15T16:45:38","slug":"an-introduction-to-wp-cli-custom-commands","status":"publish","type":"wcb_session","link":"https:\/\/pune.wordcamp.org\/2024\/session\/an-introduction-to-wp-cli-custom-commands\/","title":{"rendered":"An introduction to WP CLI &amp; custom commands"},"content":{"rendered":"\n<p>For WordPress developers, this session will be handy in understanding how to use WP-CLI along with writing your own custom commands.<\/p>\n\n\n\n<p>We expect attendees to bring along their laptops. Charging points and table with chairs at the workshop room have been arranged.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Intro: short overview on topic and getting people ready<\/li>\n\n\n\n<li>Local dev: setup development env (local by flywheel or any other suggestion)<\/li>\n\n\n\n<li>Handbook: quick walkthrough of official docs and how to navigate and use<\/li>\n\n\n\n<li>Anatomy of a command: overview on cli command structure when running commands (using core commands)<\/li>\n\n\n\n<li>Setting up plugin: getting base ready to use for command handson<\/li>\n\n\n\n<li>Writing custom commands (function\/closure)\n<ul class=\"wp-block-list\">\n<li>check for WP CLI and load command conditionally<\/li>\n\n\n\n<li>basic command to get started<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Command response design for feedback\n<ul class=\"wp-block-list\">\n<li>msg\/notice to be displayed from command via following internal helpers\n<ul class=\"wp-block-list\">\n<li>line<\/li>\n\n\n\n<li>info<\/li>\n\n\n\n<li>warning<\/li>\n\n\n\n<li>error<\/li>\n\n\n\n<li>error_multi_line<\/li>\n\n\n\n<li>success<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>colorize<\/li>\n\n\n\n<li>Progress bar for working with large data set<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Command arguments\n<ul class=\"wp-block-list\">\n<li>positional arguments<\/li>\n\n\n\n<li>flags<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>class based command\n<ul class=\"wp-block-list\">\n<li>registering command<\/li>\n\n\n\n<li>supporting subcommands<\/li>\n\n\n\n<li>Add helper\/internal functions<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Command help documentation<\/li>\n\n\n\n<li>Conclusion\/Resource sharing<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>For WordPress developers, this session will be handy in understanding how to use WP-CLI along with writing your own custom commands. We expect attendees to bring along their laptops. Charging points and table with chairs at the workshop room have been arranged.<\/p>\n","protected":false},"author":14745906,"featured_media":0,"template":"","meta":{"jetpack_post_was_ever_published":false,"_wcpt_session_time":1708145100,"_wcpt_session_duration":7200,"_wcpt_session_type":"session","_wcpt_session_slides":"","_wcpt_session_video":"","_wcpt_speaker_id":[1164,1344,1071],"footnotes":""},"session_track":[40],"session_category":[],"class_list":["post-1180","wcb_session","type-wcb_session","status-publish","hentry","wcb_track-room-three"],"jetpack_sharing_enabled":true,"session_date_time":{"date":"February 17, 2024","time":"10:15 am"},"session_speakers":[{"id":"1164","slug":"abhishek-deshpande","name":"Abhishek Deshpande","link":"https:\/\/pune.wordcamp.org\/2024\/speaker\/abhishek-deshpande\/"},{"id":"1344","slug":"ajit-bohra","name":"Ajit Bohra","link":"https:\/\/pune.wordcamp.org\/2024\/speaker\/ajit-bohra\/"},{"id":"1071","slug":"makarand-g-mane","name":"Makarand G. Mane","link":"https:\/\/pune.wordcamp.org\/2024\/speaker\/makarand-g-mane\/"}],"session_cats_rendered":null,"_links":{"self":[{"href":"https:\/\/pune.wordcamp.org\/2024\/wp-json\/wp\/v2\/sessions\/1180","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pune.wordcamp.org\/2024\/wp-json\/wp\/v2\/sessions"}],"about":[{"href":"https:\/\/pune.wordcamp.org\/2024\/wp-json\/wp\/v2\/types\/wcb_session"}],"version-history":[{"count":3,"href":"https:\/\/pune.wordcamp.org\/2024\/wp-json\/wp\/v2\/sessions\/1180\/revisions"}],"predecessor-version":[{"id":1838,"href":"https:\/\/pune.wordcamp.org\/2024\/wp-json\/wp\/v2\/sessions\/1180\/revisions\/1838"}],"speakers":[{"embeddable":true,"href":"https:\/\/pune.wordcamp.org\/2024\/wp-json\/wp\/v2\/speakers\/1164"},{"embeddable":true,"href":"https:\/\/pune.wordcamp.org\/2024\/wp-json\/wp\/v2\/speakers\/1344"},{"embeddable":true,"href":"https:\/\/pune.wordcamp.org\/2024\/wp-json\/wp\/v2\/speakers\/1071"}],"author":[{"embeddable":true,"href":"https:\/\/pune.wordcamp.org\/2024\/wp-json\/wporg\/v1\/users\/fitehal"}],"wp:attachment":[{"href":"https:\/\/pune.wordcamp.org\/2024\/wp-json\/wp\/v2\/media?parent=1180"}],"wp:term":[{"taxonomy":"wcb_track","embeddable":true,"href":"https:\/\/pune.wordcamp.org\/2024\/wp-json\/wp\/v2\/session_track?post=1180"},{"taxonomy":"wcb_session_category","embeddable":true,"href":"https:\/\/pune.wordcamp.org\/2024\/wp-json\/wp\/v2\/session_category?post=1180"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}