Skip to content

Instantly share code, notes, and snippets.

@caugner
Created April 11, 2019 12:49
Show Gist options
  • Save caugner/0580e6df415ef153d26e2510e10d58f5 to your computer and use it in GitHub Desktop.
Save caugner/0580e6df415ef153d26e2510e10d58f5 to your computer and use it in GitHub Desktop.
Font Awesome 4to5
<?php
if ($argc !== 2) {
echo "USAGE: $argv[0] PATH";
exit(1);
}
$root = $argv[1];
if (!is_dir($root)) {
echo "ERROR: $root is not a directory.";
exit(1);
}
$mapping = [
"fa fa-500px" => "fab fa-500px",
"fa fa-address-book-o" => "far fa-address-book",
"fa fa-address-card-o" => "far fa-address-card",
"fa fa-adn" => "fab fa-adn",
"fa fa-amazon" => "fab fa-amazon",
"fa fa-android" => "fab fa-android",
"fa fa-angellist" => "fab fa-angellist",
"fa fa-apple" => "fab fa-apple",
"fa fa-area-chart" => "fas fa-chart-area",
"fa fa-arrow-circle-o-down" => "far fa-arrow-alt-circle-down",
"fa fa-arrow-circle-o-left" => "far fa-arrow-alt-circle-left",
"fa fa-arrow-circle-o-right" => "far fa-arrow-alt-circle-right",
"fa fa-arrow-circle-o-up" => "far fa-arrow-alt-circle-up",
"fa fa-arrows" => "fas fa-arrows-alt",
"fa fa-arrows-alt" => "fas fa-expand-arrows-alt",
"fa fa-arrows-h" => "fas fa-arrows-alt-h",
"fa fa-arrows-v" => "fas fa-arrows-alt-v",
"fa fa-asl-interpreting" => "fas fa-american-sign-language-interpreting",
"fa fa-automobile" => "fas fa-car",
"fa fa-bandcamp" => "fab fa-bandcamp",
"fa fa-bank" => "fas fa-university",
"fa fa-bar-chart" => "far fa-chart-bar",
"fa fa-bar-chart-o" => "far fa-chart-bar",
"fa fa-bathtub" => "fas fa-bath",
"fa fa-battery" => "fas fa-battery-full",
"fa fa-battery-0" => "fas fa-battery-empty",
"fa fa-battery-1" => "fas fa-battery-quarter",
"fa fa-battery-2" => "fas fa-battery-half",
"fa fa-battery-3" => "fas fa-battery-three-quarters",
"fa fa-battery-4" => "fas fa-battery-full",
"fa fa-behance" => "fab fa-behance",
"fa fa-behance-square" => "fab fa-behance-square",
"fa fa-bell-o" => "far fa-bell",
"fa fa-bell-slash-o" => "far fa-bell-slash",
"fa fa-bitbucket" => "fab fa-bitbucket",
"fa fa-bitbucket-square" => "fab fa-bitbucket",
"fa fa-bitcoin" => "fab fa-btc",
"fa fa-black-tie" => "fab fa-black-tie",
"fa fa-bluetooth" => "fab fa-bluetooth",
"fa fa-bluetooth-b" => "fab fa-bluetooth-b",
"fa fa-bookmark-o" => "far fa-bookmark",
"fa fa-btc" => "fab fa-btc",
"fa fa-building-o" => "far fa-building",
"fa fa-buysellads" => "fab fa-buysellads",
"fa fa-cab" => "fas fa-taxi",
"fa fa-calendar" => "fas fa-calendar-alt",
"fa fa-calendar-check-o" => "far fa-calendar-check",
"fa fa-calendar-minus-o" => "far fa-calendar-minus",
"fa fa-calendar-o" => "far fa-calendar",
"fa fa-calendar-plus-o" => "far fa-calendar-plus",
"fa fa-calendar-times-o" => "far fa-calendar-times",
"fa fa-caret-square-o-down" => "far fa-caret-square-down",
"fa fa-caret-square-o-left" => "far fa-caret-square-left",
"fa fa-caret-square-o-right" => "far fa-caret-square-right",
"fa fa-caret-square-o-up" => "far fa-caret-square-up",
"fa fa-cc" => "far fa-closed-captioning",
"fa fa-cc-amex" => "fab fa-cc-amex",
"fa fa-cc-diners-club" => "fab fa-cc-diners-club",
"fa fa-cc-discover" => "fab fa-cc-discover",
"fa fa-cc-jcb" => "fab fa-cc-jcb",
"fa fa-cc-mastercard" => "fab fa-cc-mastercard",
"fa fa-cc-paypal" => "fab fa-cc-paypal",
"fa fa-cc-stripe" => "fab fa-cc-stripe",
"fa fa-cc-visa" => "fab fa-cc-visa",
"fa fa-chain" => "fas fa-link",
"fa fa-chain-broken" => "fas fa-unlink",
"fa fa-check-circle-o" => "far fa-check-circle",
"fa fa-check-square-o" => "far fa-check-square",
"fa fa-chrome" => "fab fa-chrome",
"fa fa-circle-o" => "far fa-circle",
"fa fa-circle-o-notch" => "fas fa-circle-notch",
"fa fa-circle-thin" => "far fa-circle",
"fa fa-clipboard" => "far fa-clipboard",
"fa fa-clock-o" => "far fa-clock",
"fa fa-clone" => "far fa-clone",
"fa fa-close" => "fas fa-times",
"fa fa-cloud-download" => "fas fa-cloud-download-alt",
"fa fa-cloud-upload" => "fas fa-cloud-upload-alt",
"fa fa-cny" => "fas fa-yen-sign",
"fa fa-code-fork" => "fas fa-code-branch",
"fa fa-codepen" => "fab fa-codepen",
"fa fa-codiepie" => "fab fa-codiepie",
"fa fa-comment-o" => "far fa-comment",
"fa fa-commenting" => "fas fa-comment-dots",
"fa fa-commenting-o" => "far fa-comment-dots",
"fa fa-comments-o" => "far fa-comments",
"fa fa-compass" => "far fa-compass",
"fa fa-connectdevelop" => "fab fa-connectdevelop",
"fa fa-contao" => "fab fa-contao",
"fa fa-copyright" => "far fa-copyright",
"fa fa-creative-commons" => "fab fa-creative-commons",
"fa fa-credit-card" => "far fa-credit-card",
"fa fa-credit-card-alt" => "fas fa-credit-card",
"fa fa-css3" => "fab fa-css3",
"fa fa-cutlery" => "fas fa-utensils",
"fa fa-dashboard" => "fas fa-tachometer-alt",
"fa fa-dashcube" => "fab fa-dashcube",
"fa fa-deafness" => "fas fa-deaf",
"fa fa-dedent" => "fas fa-outdent",
"fa fa-delicious" => "fab fa-delicious",
"fa fa-deviantart" => "fab fa-deviantart",
"fa fa-diamond" => "far fa-gem",
"fa fa-digg" => "fab fa-digg",
"fa fa-dollar" => "fas fa-dollar-sign",
"fa fa-dot-circle-o" => "far fa-dot-circle",
"fa fa-dribbble" => "fab fa-dribbble",
"fa fa-drivers-license" => "fas fa-id-card",
"fa fa-drivers-license-o" => "far fa-id-card",
"fa fa-dropbox" => "fab fa-dropbox",
"fa fa-drupal" => "fab fa-drupal",
"fa fa-edge" => "fab fa-edge",
"fa fa-eercast" => "fab fa-sellcast",
"fa fa-empire" => "fab fa-empire",
"fa fa-envelope-o" => "far fa-envelope",
"fa fa-envelope-open-o" => "far fa-envelope-open",
"fa fa-envira" => "fab fa-envira",
"fa fa-etsy" => "fab fa-etsy",
"fa fa-eur" => "fas fa-euro-sign",
"fa fa-euro" => "fas fa-euro-sign",
"fa fa-exchange" => "fas fa-exchange-alt",
"fa fa-expeditedssl" => "fab fa-expeditedssl",
"fa fa-external-link" => "fas fa-external-link-alt",
"fa fa-external-link-square" => "fas fa-external-link-square-alt",
"fa fa-eye" => "far fa-eye",
"fa fa-eye-slash" => "far fa-eye-slash",
"fa fa-eyedropper" => "fas fa-eye-dropper",
"fa fa-fa" => "fab fa-font-awesome",
"fa fa-facebook" => "fab fa-facebook-f",
"fa fa-facebook-f" => "fab fa-facebook-f",
"fa fa-facebook-official" => "fab fa-facebook",
"fa fa-facebook-square" => "fab fa-facebook-square",
"fa fa-feed" => "fas fa-rss",
"fa fa-file-archive-o" => "far fa-file-archive",
"fa fa-file-audio-o" => "far fa-file-audio",
"fa fa-file-code-o" => "far fa-file-code",
"fa fa-file-excel-o" => "far fa-file-excel",
"fa fa-file-image-o" => "far fa-file-image",
"fa fa-file-movie-o" => "far fa-file-video",
"fa fa-file-o" => "far fa-file",
"fa fa-file-pdf-o" => "far fa-file-pdf",
"fa fa-file-photo-o" => "far fa-file-image",
"fa fa-file-picture-o" => "far fa-file-image",
"fa fa-file-powerpoint-o" => "far fa-file-powerpoint",
"fa fa-file-sound-o" => "far fa-file-audio",
"fa fa-file-text" => "fas fa-file-alt",
"fa fa-file-text-o" => "far fa-file-alt",
"fa fa-file-video-o" => "far fa-file-video",
"fa fa-file-word-o" => "far fa-file-word",
"fa fa-file-zip-o" => "far fa-file-archive",
"fa fa-files-o" => "far fa-copy",
"fa fa-firefox" => "fab fa-firefox",
"fa fa-first-order" => "fab fa-first-order",
"fa fa-flag-o" => "far fa-flag",
"fa fa-flash" => "fas fa-bolt",
"fa fa-flickr" => "fab fa-flickr",
"fa fa-floppy-o" => "far fa-save",
"fa fa-folder-o" => "far fa-folder",
"fa fa-folder-open-o" => "far fa-folder-open",
"fa fa-font-awesome" => "fab fa-font-awesome",
"fa fa-fonticons" => "fab fa-fonticons",
"fa fa-fort-awesome" => "fab fa-fort-awesome",
"fa fa-forumbee" => "fab fa-forumbee",
"fa fa-foursquare" => "fab fa-foursquare",
"fa fa-free-code-camp" => "fab fa-free-code-camp",
"fa fa-frown-o" => "far fa-frown",
"fa fa-futbol-o" => "far fa-futbol",
"fa fa-gbp" => "fas fa-pound-sign",
"fa fa-ge" => "fab fa-empire",
"fa fa-gear" => "fas fa-cog",
"fa fa-gears" => "fas fa-cogs",
"fa fa-get-pocket" => "fab fa-get-pocket",
"fa fa-gg" => "fab fa-gg",
"fa fa-gg-circle" => "fab fa-gg-circle",
"fa fa-git" => "fab fa-git",
"fa fa-git-square" => "fab fa-git-square",
"fa fa-github" => "fab fa-github",
"fa fa-github-alt" => "fab fa-github-alt",
"fa fa-github-square" => "fab fa-github-square",
"fa fa-gitlab" => "fab fa-gitlab",
"fa fa-gittip" => "fab fa-gratipay",
"fa fa-glass" => "fas fa-glass-martini",
"fa fa-glide" => "fab fa-glide",
"fa fa-glide-g" => "fab fa-glide-g",
"fa fa-google" => "fab fa-google",
"fa fa-google-plus" => "fab fa-google-plus-g",
"fa fa-google-plus-circle" => "fab fa-google-plus",
"fa fa-google-plus-official" => "fab fa-google-plus",
"fa fa-google-plus-square" => "fab fa-google-plus-square",
"fa fa-google-wallet" => "fab fa-google-wallet",
"fa fa-gratipay" => "fab fa-gratipay",
"fa fa-grav" => "fab fa-grav",
"fa fa-group" => "fas fa-users",
"fa fa-hacker-news" => "fab fa-hacker-news",
"fa fa-hand-grab-o" => "far fa-hand-rock",
"fa fa-hand-lizard-o" => "far fa-hand-lizard",
"fa fa-hand-o-down" => "far fa-hand-point-down",
"fa fa-hand-o-left" => "far fa-hand-point-left",
"fa fa-hand-o-right" => "far fa-hand-point-right",
"fa fa-hand-o-up" => "far fa-hand-point-up",
"fa fa-hand-paper-o" => "far fa-hand-paper",
"fa fa-hand-peace-o" => "far fa-hand-peace",
"fa fa-hand-pointer-o" => "far fa-hand-pointer",
"fa fa-hand-rock-o" => "far fa-hand-rock",
"fa fa-hand-scissors-o" => "far fa-hand-scissors",
"fa fa-hand-spock-o" => "far fa-hand-spock",
"fa fa-hand-stop-o" => "far fa-hand-paper",
"fa fa-handshake-o" => "far fa-handshake",
"fa fa-hard-of-hearing" => "fas fa-deaf",
"fa fa-hdd-o" => "far fa-hdd",
"fa fa-header" => "fas fa-heading",
"fa fa-heart-o" => "far fa-heart",
"fa fa-hospital-o" => "far fa-hospital",
"fa fa-hotel" => "fas fa-bed",
"fa fa-hourglass-1" => "fas fa-hourglass-start",
"fa fa-hourglass-2" => "fas fa-hourglass-half",
"fa fa-hourglass-3" => "fas fa-hourglass-end",
"fa fa-hourglass-o" => "far fa-hourglass",
"fa fa-houzz" => "fab fa-houzz",
"fa fa-html5" => "fab fa-html5",
"fa fa-id-badge" => "far fa-id-badge",
"fa fa-id-card-o" => "far fa-id-card",
"fa fa-ils" => "fas fa-shekel-sign",
"fa fa-image" => "far fa-image",
"fa fa-imdb" => "fab fa-imdb",
"fa fa-inr" => "fas fa-rupee-sign",
"fa fa-instagram" => "fab fa-instagram",
"fa fa-institution" => "fas fa-university",
"fa fa-internet-explorer" => "fab fa-internet-explorer",
"fa fa-intersex" => "fas fa-transgender",
"fa fa-ioxhost" => "fab fa-ioxhost",
"fa fa-joomla" => "fab fa-joomla",
"fa fa-jpy" => "fas fa-yen-sign",
"fa fa-jsfiddle" => "fab fa-jsfiddle",
"fa fa-keyboard-o" => "far fa-keyboard",
"fa fa-krw" => "fas fa-won-sign",
"fa fa-lastfm" => "fab fa-lastfm",
"fa fa-lastfm-square" => "fab fa-lastfm-square",
"fa fa-leanpub" => "fab fa-leanpub",
"fa fa-legal" => "fas fa-gavel",
"fa fa-lemon-o" => "far fa-lemon",
"fa fa-level-down" => "fas fa-level-down-alt",
"fa fa-level-up" => "fas fa-level-up-alt",
"fa fa-life-bouy" => "far fa-life-ring",
"fa fa-life-buoy" => "far fa-life-ring",
"fa fa-life-ring" => "far fa-life-ring",
"fa fa-life-saver" => "far fa-life-ring",
"fa fa-lightbulb-o" => "far fa-lightbulb",
"fa fa-line-chart" => "fas fa-chart-line",
"fa fa-linkedin" => "fab fa-linkedin-in",
"fa fa-linkedin-square" => "fab fa-linkedin",
"fa fa-linode" => "fab fa-linode",
"fa fa-linux" => "fab fa-linux",
"fa fa-list-alt" => "far fa-list-alt",
"fa fa-long-arrow-down" => "fas fa-long-arrow-alt-down",
"fa fa-long-arrow-left" => "fas fa-long-arrow-alt-left",
"fa fa-long-arrow-right" => "fas fa-long-arrow-alt-right",
"fa fa-long-arrow-up" => "fas fa-long-arrow-alt-up",
"fa fa-mail-forward" => "fas fa-share",
"fa fa-mail-reply" => "fas fa-reply",
"fa fa-mail-reply-all" => "fas fa-reply-all",
"fa fa-map-marker" => "fas fa-map-marker-alt",
"fa fa-map-o" => "far fa-map",
"fa fa-maxcdn" => "fab fa-maxcdn",
"fa fa-meanpath" => "fab fa-font-awesome",
"fa fa-medium" => "fab fa-medium",
"fa fa-meetup" => "fab fa-meetup",
"fa fa-meh-o" => "far fa-meh",
"fa fa-minus-square-o" => "far fa-minus-square",
"fa fa-mixcloud" => "fab fa-mixcloud",
"fa fa-mobile" => "fas fa-mobile-alt",
"fa fa-mobile-phone" => "fas fa-mobile-alt",
"fa fa-modx" => "fab fa-modx",
"fa fa-money" => "far fa-money-bill-alt",
"fa fa-moon-o" => "far fa-moon",
"fa fa-mortar-board" => "fas fa-graduation-cap",
"fa fa-navicon" => "fas fa-bars",
"fa fa-newspaper-o" => "far fa-newspaper",
"fa fa-object-group" => "far fa-object-group",
"fa fa-object-ungroup" => "far fa-object-ungroup",
"fa fa-odnoklassniki" => "fab fa-odnoklassniki",
"fa fa-odnoklassniki-square" => "fab fa-odnoklassniki-square",
"fa fa-opencart" => "fab fa-opencart",
"fa fa-openid" => "fab fa-openid",
"fa fa-opera" => "fab fa-opera",
"fa fa-optin-monster" => "fab fa-optin-monster",
"fa fa-pagelines" => "fab fa-pagelines",
"fa fa-paper-plane-o" => "far fa-paper-plane",
"fa fa-paste" => "far fa-clipboard",
"fa fa-pause-circle-o" => "far fa-pause-circle",
"fa fa-paypal" => "fab fa-paypal",
"fa fa-pencil" => "fas fa-pencil-alt",
"fa fa-pencil-square" => "fas fa-pen-square",
"fa fa-pencil-square-o" => "far fa-edit",
"fa fa-photo" => "far fa-image",
"fa fa-picture-o" => "far fa-image",
"fa fa-pie-chart" => "fas fa-chart-pie",
"fa fa-pied-piper" => "fab fa-pied-piper",
"fa fa-pied-piper-alt" => "fab fa-pied-piper-alt",
"fa fa-pied-piper-pp" => "fab fa-pied-piper-pp",
"fa fa-pinterest" => "fab fa-pinterest",
"fa fa-pinterest-p" => "fab fa-pinterest-p",
"fa fa-pinterest-square" => "fab fa-pinterest-square",
"fa fa-play-circle-o" => "far fa-play-circle",
"fa fa-plus-square-o" => "far fa-plus-square",
"fa fa-product-hunt" => "fab fa-product-hunt",
"fa fa-qq" => "fab fa-qq",
"fa fa-question-circle-o" => "far fa-question-circle",
"fa fa-quora" => "fab fa-quora",
"fa fa-ra" => "fab fa-rebel",
"fa fa-ravelry" => "fab fa-ravelry",
"fa fa-rebel" => "fab fa-rebel",
"fa fa-reddit" => "fab fa-reddit",
"fa fa-reddit-alien" => "fab fa-reddit-alien",
"fa fa-reddit-square" => "fab fa-reddit-square",
"fa fa-refresh" => "fas fa-sync",
"fa fa-registered" => "far fa-registered",
"fa fa-remove" => "fas fa-times",
"fa fa-renren" => "fab fa-renren",
"fa fa-reorder" => "fas fa-bars",
"fa fa-repeat" => "fas fa-redo",
"fa fa-resistance" => "fab fa-rebel",
"fa fa-rmb" => "fas fa-yen-sign",
"fa fa-rotate-left" => "fas fa-undo",
"fa fa-rotate-right" => "fas fa-redo",
"fa fa-rouble" => "fas fa-ruble-sign",
"fa fa-rub" => "fas fa-ruble-sign",
"fa fa-ruble" => "fas fa-ruble-sign",
"fa fa-rupee" => "fas fa-rupee-sign",
"fa fa-s15" => "fas fa-bath",
"fa fa-safari" => "fab fa-safari",
"fa fa-scissors" => "fas fa-cut",
"fa fa-scribd" => "fab fa-scribd",
"fa fa-sellsy" => "fab fa-sellsy",
"fa fa-send" => "fas fa-paper-plane",
"fa fa-send-o" => "far fa-paper-plane",
"fa fa-share-square-o" => "far fa-share-square",
"fa fa-shekel" => "fas fa-shekel-sign",
"fa fa-sheqel" => "fas fa-shekel-sign",
"fa fa-shield" => "fas fa-shield-alt",
"fa fa-shirtsinbulk" => "fab fa-shirtsinbulk",
"fa fa-sign-in" => "fas fa-sign-in-alt",
"fa fa-sign-out" => "fas fa-sign-out-alt",
"fa fa-signing" => "fas fa-sign-language",
"fa fa-simplybuilt" => "fab fa-simplybuilt",
"fa fa-skyatlas" => "fab fa-skyatlas",
"fa fa-skype" => "fab fa-skype",
"fa fa-slack" => "fab fa-slack",
"fa fa-sliders" => "fas fa-sliders-h",
"fa fa-slideshare" => "fab fa-slideshare",
"fa fa-smile-o" => "far fa-smile",
"fa fa-snapchat" => "fab fa-snapchat",
"fa fa-snapchat-ghost" => "fab fa-snapchat-ghost",
"fa fa-snapchat-square" => "fab fa-snapchat-square",
"fa fa-snowflake-o" => "far fa-snowflake",
"fa fa-soccer-ball-o" => "far fa-futbol",
"fa fa-sort-alpha-asc" => "fas fa-sort-alpha-down",
"fa fa-sort-alpha-desc" => "fas fa-sort-alpha-up",
"fa fa-sort-amount-asc" => "fas fa-sort-amount-down",
"fa fa-sort-amount-desc" => "fas fa-sort-amount-up",
"fa fa-sort-asc" => "fas fa-sort-up",
"fa fa-sort-desc" => "fas fa-sort-down",
"fa fa-sort-numeric-asc" => "fas fa-sort-numeric-down",
"fa fa-sort-numeric-desc" => "fas fa-sort-numeric-up",
"fa fa-soundcloud" => "fab fa-soundcloud",
"fa fa-spoon" => "fas fa-utensil-spoon",
"fa fa-spotify" => "fab fa-spotify",
"fa fa-square-o" => "far fa-square",
"fa fa-stack-exchange" => "fab fa-stack-exchange",
"fa fa-stack-overflow" => "fab fa-stack-overflow",
"fa fa-star-half-empty" => "far fa-star-half",
"fa fa-star-half-full" => "far fa-star-half",
"fa fa-star-half-o" => "far fa-star-half",
"fa fa-star-o" => "far fa-star",
"fa fa-steam" => "fab fa-steam",
"fa fa-steam-square" => "fab fa-steam-square",
"fa fa-sticky-note-o" => "far fa-sticky-note",
"fa fa-stop-circle-o" => "far fa-stop-circle",
"fa fa-stumbleupon" => "fab fa-stumbleupon",
"fa fa-stumbleupon-circle" => "fab fa-stumbleupon-circle",
"fa fa-sun-o" => "far fa-sun",
"fa fa-superpowers" => "fab fa-superpowers",
"fa fa-support" => "far fa-life-ring",
"fa fa-tablet" => "fas fa-tablet-alt",
"fa fa-tachometer" => "fas fa-tachometer-alt",
"fa fa-telegram" => "fab fa-telegram",
"fa fa-television" => "fas fa-tv",
"fa fa-tencent-weibo" => "fab fa-tencent-weibo",
"fa fa-themeisle" => "fab fa-themeisle",
"fa fa-thermometer" => "fas fa-thermometer-full",
"fa fa-thermometer-0" => "fas fa-thermometer-empty",
"fa fa-thermometer-1" => "fas fa-thermometer-quarter",
"fa fa-thermometer-2" => "fas fa-thermometer-half",
"fa fa-thermometer-3" => "fas fa-thermometer-three-quarters",
"fa fa-thermometer-4" => "fas fa-thermometer-full",
"fa fa-thumb-tack" => "fas fa-thumbtack",
"fa fa-thumbs-o-down" => "far fa-thumbs-down",
"fa fa-thumbs-o-up" => "far fa-thumbs-up",
"fa fa-ticket" => "fas fa-ticket-alt",
"fa fa-times-circle-o" => "far fa-times-circle",
"fa fa-times-rectangle" => "fas fa-window-close",
"fa fa-times-rectangle-o" => "far fa-window-close",
"fa fa-toggle-down" => "far fa-caret-square-down",
"fa fa-toggle-left" => "far fa-caret-square-left",
"fa fa-toggle-right" => "far fa-caret-square-right",
"fa fa-toggle-up" => "far fa-caret-square-up",
"fa fa-trash" => "fas fa-trash-alt",
"fa fa-trash-o" => "far fa-trash-alt",
"fa fa-trello" => "fab fa-trello",
"fa fa-tripadvisor" => "fab fa-tripadvisor",
"fa fa-try" => "fas fa-lira-sign",
"fa fa-tumblr" => "fab fa-tumblr",
"fa fa-tumblr-square" => "fab fa-tumblr-square",
"fa fa-turkish-lira" => "fas fa-lira-sign",
"fa fa-twitch" => "fab fa-twitch",
"fa fa-twitter" => "fab fa-twitter",
"fa fa-twitter-square" => "fab fa-twitter-square",
"fa fa-unsorted" => "fas fa-sort",
"fa fa-usb" => "fab fa-usb",
"fa fa-usd" => "fas fa-dollar-sign",
"fa fa-user-circle-o" => "far fa-user-circle",
"fa fa-user-o" => "far fa-user",
"fa fa-vcard" => "fas fa-address-card",
"fa fa-vcard-o" => "far fa-address-card",
"fa fa-viacoin" => "fab fa-viacoin",
"fa fa-viadeo" => "fab fa-viadeo",
"fa fa-viadeo-square" => "fab fa-viadeo-square",
"fa fa-video-camera" => "fas fa-video",
"fa fa-vimeo" => "fab fa-vimeo-v",
"fa fa-vimeo-square" => "fab fa-vimeo-square",
"fa fa-vine" => "fab fa-vine",
"fa fa-vk" => "fab fa-vk",
"fa fa-volume-control-phone" => "fas fa-phone-volume",
"fa fa-warning" => "fas fa-exclamation-triangle",
"fa fa-wechat" => "fab fa-weixin",
"fa fa-weibo" => "fab fa-weibo",
"fa fa-weixin" => "fab fa-weixin",
"fa fa-whatsapp" => "fab fa-whatsapp",
"fa fa-wheelchair-alt" => "fab fa-accessible-icon",
"fa fa-wikipedia-w" => "fab fa-wikipedia-w",
"fa fa-window-close-o" => "far fa-window-close",
"fa fa-window-maximize" => "far fa-window-maximize",
"fa fa-window-restore" => "far fa-window-restore",
"fa fa-windows" => "fab fa-windows",
"fa fa-won" => "fas fa-won-sign",
"fa fa-wordpress" => "fab fa-wordpress",
"fa fa-wpbeginner" => "fab fa-wpbeginner",
"fa fa-wpexplorer" => "fab fa-wpexplorer",
"fa fa-wpforms" => "fab fa-wpforms",
"fa fa-xing" => "fab fa-xing",
"fa fa-xing-square" => "fab fa-xing-square",
"fa fa-y-combinator" => "fab fa-y-combinator",
"fa fa-y-combinator-square" => "fab fa-hacker-news",
"fa fa-yahoo" => "fab fa-yahoo",
"fa fa-yc" => "fab fa-y-combinator",
"fa fa-yc-square" => "fab fa-hacker-news",
"fa fa-yelp" => "fab fa-yelp",
"fa fa-yen" => "fas fa-yen-sign",
"fa fa-yoast" => "fab fa-yoast",
"fa fa-youtube" => "fab fa-youtube",
"fa fa-youtube-play" => "fab fa-youtube",
"fa fa-youtube-square" => "fab fa-youtube-square"
];
$search = array_keys($mapping);
$replace = array_values($mapping);
$iterator = new RecursiveIteratorIterator(
new RecursiveCallbackFilterIterator(
new RecursiveDirectoryIterator($root),
function(string $dir) {
$basename = basename($dir);
return $basename[0] !== '.' && !in_array($basename, ['node_modules', 'vendor']);
}
)
);
$handle = fopen ("php://stdin","r");
foreach ($iterator as $file) {
$basename = basename($file);
if ($basename[0] === '.') {
continue;
}
if (is_file($file)) {
$content = file_get_contents($file);
$newContent = str_replace($search, $replace, $content);
if ($content !== $newContent) {
printf("\nFix %s? [Y/n] ", $file);
$char = trim(fgetc($handle));
print("\n=> ");
if (preg_match("/^y?$/i", $char)) {
if (file_put_contents($file, $newContent) !== false) {
print("Fixed.");
} else {
print("FAILED!");
}
} else {
print("Skipped.");
}
print("\n");
} else {
print(".");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment