├── .gitignore ├── README.md ├── abbreviations.fish ├── apache-skeleton.conf ├── completions ├── composer.fish ├── git.fish └── gitignore.fish ├── conf.d ├── nerd-fonts.fish └── omf.fish ├── config.fish ├── functions ├── __byscripts_ask.fish ├── __byscripts_blue.fish ├── __byscripts_confirm.fish ├── __byscripts_green.fish ├── __byscripts_red.fish ├── __byscripts_spinner.fish ├── add_to_hosts.fish ├── create-domain.fish ├── delete-domain.fish ├── fish_prompt.fish ├── gitignore.fish ├── make_completion.fish ├── mkcd.fish ├── mongochef-update.fish ├── php-symlink-remove.fish ├── php-symlink.fish ├── phpstorm-update.fish ├── symfo-acl.fish └── symfo3-acl.fish └── update_doc /.gitignore: -------------------------------------------------------------------------------- 1 | fishd.* 2 | fish_history 3 | generated_completions 4 | fish_read_history 5 | .idea 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | fish-config 2 | =========== 3 | 4 | Fish Shell configuration files 5 | 6 | Abbreviations 7 | ------------- 8 | 9 | [//]: # (abbreviations) 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 |
Apache
a2reloadsudo service apache2 reload
a2restartsudo service apache2 restart
Artisan
aphp artisan
Apt-Get
arsudo apt-get autoremove
dugsudo apt-get dist-upgrade
isudo apt-get install
rsudo apt-get remove
usudo apt-get update
ugsudo apt-get upgrade
Bower
bbower
bibower install --save
bpbower prune
bubower update
Composer
ccomposer
cicomposer install
crcomposer require
crdcomposer require --dev
csusudo composer self-update
cucomposer update
cvcomposer validate
Git
ggit
ga.git add .
gagit add
gbgit branch
gbdgit branch -D
gcmgit commit -m
gcm!!!git add .; and git commit -m "Update"; and git push
gcogit checkout
gcobgit checkout -b
gigitignore
gmgit merge
gplgit pull
gpsgit push
gpsugit push -u origin master
gsgit status
gcgit clone
gdgit diff
Git Flow AVH
gfgit flow
gfigit flow init -d
gffgit flow feature
gffsgit flow feature start
gfffgit flow feature finish
gffpgit flow feature publish
gfftgit flow feature track
gffcogit flow feature checkout
gfrgit flow release
gfrsgit flow release start
gfrfgit flow release finish
gfrpgit flow release publish
gfrtgit flow release track
gfrcogit flow release checkout
gfbgit flow bugfix
gfbsgit flow bugfix start
gfbfgit flow bugfix finish
gfbpgit flow bugfix publish
gfbtgit flow bugfix track
gfbcogit flow bugfix checkout
gfhgit flow hotfix
gfhsgit flow hotfix start
gfhfgit flow hotfix finish
gfhpgit flow hotfix publish
gfhtgit flow hotfix track
gfhcogit flow hotfix checkout
LS
lls
NPM
ninpm install
nisnpm install --save
nisdnpm install --save-dev
nignpm install -g
npnpm prune
nlnpm list
nrnpm remove
nunpm update
RM
rmrf"rm -rf"
Symfony 2.x
s2php app/console
s2ccphp app/console cache:clear
s2ccpphp app/console cache:clear --env=prod
s2cctphp app/console cache:clear --env=test
s2gbphp app/console generate:bundle
s2gcphp app/console generate:controller
s2dgephp app/console doctrine:generate:entity
s2dscphp app/console doctrine:schema:create
s2dsuphp app/console doctrine:schema:update
s2dsvphp app/console doctrine:schema:validate
s2ddcphp app/console doctrine:database:create
Symfony 3.x
sphp bin/console
sccphp bin/console cache:clear
sccpphp bin/console cache:clear --env=prod
scctphp bin/console cache:clear --env=test
sgbphp bin/console generate:bundle
sgcphp bin/console generate:controller
sdgephp bin/console doctrine:generate:entity
sdscphp bin/console doctrine:schema:create
sdsuphp bin/console doctrine:schema:update
sdsvphp bin/console doctrine:schema:validate
sddcphp bin/console doctrine:database:create
Other
pgpgrep -l
psgps -ef \| grep
ccatpygmentize -g
add_to_pathset -U fish_user_paths $fish_user_paths
freebox_mountsudo mount -t cifs //mafreebox.freebox.fr/Disque\ dur /media/freebox -o user=freebox,uid=1000,gid=1000,rw,password=
164 | 165 | [//]: # (/abbreviations) 166 | 167 | Commands 168 | -------- 169 | 170 | [//]: # (commands) 171 | 172 | #### __byscripts_ask 173 | 174 | `__byscripts_ask $question`: Ask the user a `$question` and echoes the answer 175 | 176 | #### __byscripts_blue 177 | 178 | `__byscripts_blue $string`: Echoes `$string` in blue color 179 | 180 | Arguments passed to `__byscripts_blue` are propagated to `echo` 181 | 182 | #### __byscripts_confirm 183 | 184 | `__byscripts_confirm $string`: Ask the user to confirm (output: `$string [Yn]`) 185 | 186 | Return `0` (Y) or `1` (N) status to use with control structure (`if`, `while`...) 187 | 188 | #### __byscripts_green 189 | 190 | `__byscripts_green $string`: Echoes `$string` in green color 191 | 192 | Arguments passed to `__byscripts_green` are propagated to `echo` 193 | 194 | #### __byscripts_red 195 | 196 | `__byscripts_red $string`: Echoes `$string` in red color 197 | 198 | Arguments passed to `__byscripts_red` are propagated to `echo` 199 | 200 | #### __byscripts_spinner 201 | 202 | `__byscripts_spinner $pid`: Display a spinner while the process with PID `$pid` is running 203 | 204 | #### add_to_hosts 205 | 206 | `add_to_hosts `: Ask for an IP address (defaults to 127.0.0.1) and add `hostname` to /etc/hosts file. 207 | 208 | #### create-domain 209 | 210 | `create-domain foobar.tld` : 211 | 212 | * Create a `foobar.tld.conf` Apache file pointing to `/var/www/foobar.tld` 213 | * Create a `foobar-tld` MySQL database 214 | * Create a `foobar-tld` MySQL user 215 | * Grant all access on created database to created user 216 | 217 | #### delete-domain 218 | 219 | `delete-domain foobar.tld` : Reverse the `create-domain` process. Delete MySQL user, database and Apache config. 220 | 221 | #### gitignore 222 | 223 | `gitignore app1 app2 ... >> .gitignore`: Create a .gitignore from www.gitignore.io 224 | Get a list of applications with `gitignore list` or simply press TAB to get autocompletion 225 | 226 | #### mkcd 227 | 228 | `mkcd foo/bar/baz`: Runs `mkdir foo/bar/baz` then `cd foo/bar/baz` 229 | 230 | #### mongochef-update 231 | 232 | `mongochef-update `: 233 | 234 | * Copy the current `~/Applications/MongoChef` to `~/Applications/MongoChef-{timestamp}` 235 | * Download MongoChef from `` 236 | * Extract archive to `~/Applications/MongoChef` 237 | 238 | #### php-symlink-remove 239 | 240 | Remove the symlinks and copy `apache2/php.ini` back to `cli/php.ini` and `cgi/php.ini` 241 | 242 | #### php-symlink 243 | 244 | Remove `cli/php.ini` and `cgi/php.ini`, and symlink `apache2/php.ini` instead 245 | 246 | #### phpstorm-update 247 | 248 | `phpstorm-update `: 249 | 250 | * Copy the current `~/Applications/PhpStorm` to `~/Applications/PhpStorm-{timestamp}` 251 | * Download PhpStorm from `` 252 | * Extract archive to `~/Applications/PhpStorm` 253 | 254 | #### symfo-acl 255 | 256 | Set correct ACL for a Symfony app. 257 | Create `app/cache` and `app/log` if not exist, then set ACL to `www-data` and current user. 258 | 259 | #### symfo3-acl 260 | 261 | Set correct ACL for a Symfony 3 app. 262 | Create `var` if not exist, then set ACL to `www-data` and current user. 263 | 264 | [//]: # (/commands) 265 | 266 | Prompt 267 | ------ 268 | 269 | ``` 270 | ┌─ The current path, shortened 271 | │ ┌─ Git current branch 272 | │ │ ┌─ Git status ( ✓ clean / …2 untracked / ●1 staged / ✚1 modified ) 273 | │ │ │ ┌─ Current system user 274 | │ │ │ │ ┌─ Current system hostname 275 | │ │ │ │ │ ┌─ Time 276 | │ │ │ │ │ │ ┌─ A fish... 277 | ▼ ▼ ▼ ▼ ▼ ▼ ▼ 278 | ┌─┤ ~/.c/fish ├──┤ master↑1…2●1✚1 ├──┤ who@hostname ├──┤ 22:18:24 ├──┤ ><(((°> ├─────────── 279 | └─▶ _ 280 | ``` 281 | -------------------------------------------------------------------------------- /abbreviations.fish: -------------------------------------------------------------------------------- 1 | # Apache 2 | abbr a2reload 'sudo service apache2 reload' 3 | abbr a2restart 'sudo service apache2 restart' 4 | 5 | # Artisan 6 | abbr a 'php artisan' 7 | 8 | # Apt-Get 9 | abbr ar 'sudo apt-get autoremove' 10 | abbr dug 'sudo apt-get dist-upgrade' 11 | abbr i 'sudo apt-get install' 12 | abbr r 'sudo apt-get remove' 13 | abbr u 'sudo apt-get update' 14 | abbr ug 'sudo apt-get upgrade' 15 | 16 | # Bower 17 | abbr b 'bower' 18 | abbr bi 'bower install --save' 19 | abbr bp 'bower prune' 20 | abbr bu 'bower update' 21 | 22 | # Brew Cask 23 | abbr bci 'brew cask install' 24 | abbr bcu 'brew cask uninstall' 25 | abbr bcs 'brew cask search' 26 | 27 | # Composer 28 | abbr c 'composer' 29 | abbr ci 'composer install' 30 | abbr cr 'composer require' 31 | abbr crd 'composer require --dev' 32 | abbr csu 'sudo composer self-update' 33 | abbr cu 'composer update' 34 | abbr cv 'composer validate' 35 | 36 | # Git 37 | abbr g 'git' 38 | abbr ga. 'git add .' 39 | abbr ga 'git add' 40 | abbr gb 'git branch' 41 | abbr gbd 'git branch -D' 42 | abbr gcm 'git commit -m' 43 | abbr gcm!!! 'git add .; and git commit -m "Update"; and git push' 44 | abbr gco 'git checkout' 45 | abbr gcob 'git checkout -b' 46 | abbr gcod 'git checkout development' 47 | abbr gi 'gitignore' 48 | abbr gm 'git merge' 49 | abbr gpl 'git pull' 50 | abbr gps 'git push' 51 | abbr gpsu 'git push -u origin master' 52 | abbr gs 'git status' 53 | abbr gc 'git clone' 54 | abbr gd 'git diff' 55 | 56 | # Git Flow AVH 57 | abbr gf 'git flow' 58 | abbr gfi 'git flow init -d' 59 | 60 | abbr gff 'git flow feature' 61 | abbr gffs 'git flow feature start' 62 | abbr gfff 'git flow feature finish' 63 | abbr gffp 'git flow feature publish' 64 | abbr gfft 'git flow feature track' 65 | abbr gffco 'git flow feature checkout' 66 | 67 | abbr gfr 'git flow release' 68 | abbr gfrs 'git flow release start' 69 | abbr gfrf 'git flow release finish' 70 | abbr gfrp 'git flow release publish' 71 | abbr gfrt 'git flow release track' 72 | abbr gfrco 'git flow release checkout' 73 | 74 | abbr gfb 'git flow bugfix' 75 | abbr gfbs 'git flow bugfix start' 76 | abbr gfbf 'git flow bugfix finish' 77 | abbr gfbp 'git flow bugfix publish' 78 | abbr gfbt 'git flow bugfix track' 79 | abbr gfbco 'git flow bugfix checkout' 80 | 81 | abbr gfh 'git flow hotfix' 82 | abbr gfhs 'git flow hotfix start' 83 | abbr gfhf 'git flow hotfix finish' 84 | abbr gfhp 'git flow hotfix publish' 85 | abbr gfht 'git flow hotfix track' 86 | abbr gfhco 'git flow hotfix checkout' 87 | 88 | # LS 89 | abbr l 'ls' 90 | 91 | # NPM 92 | abbr ni 'npm install' 93 | abbr nis 'npm install --save' 94 | abbr nisd 'npm install --save-dev' 95 | abbr nig 'npm install -g' 96 | abbr np 'npm prune' 97 | abbr nl 'npm list' 98 | abbr nr 'npm remove' 99 | abbr nu 'npm update' 100 | 101 | # RM 102 | abbr rmrf "rm -rf" 103 | 104 | # Symfony 2.x 105 | abbr s2 'php app/console' 106 | abbr s2cc 'php app/console cache:clear' 107 | abbr s2ccp 'php app/console cache:clear --env=prod' 108 | abbr s2cct 'php app/console cache:clear --env=test' 109 | abbr s2gb 'php app/console generate:bundle' 110 | abbr s2gc 'php app/console generate:controller' 111 | abbr s2dge 'php app/console doctrine:generate:entity' 112 | abbr s2dsc 'php app/console doctrine:schema:create' 113 | abbr s2dsu 'php app/console doctrine:schema:update' 114 | abbr s2dsv 'php app/console doctrine:schema:validate' 115 | abbr s2ddc 'php app/console doctrine:database:create' 116 | 117 | # Symfony 3.x 118 | abbr s 'php bin/console' 119 | abbr scc 'php bin/console cache:clear' 120 | abbr sccp 'php bin/console cache:clear --env=prod' 121 | abbr scct 'php bin/console cache:clear --env=test' 122 | abbr sgb 'php bin/console generate:bundle' 123 | abbr sgc 'php bin/console generate:controller' 124 | abbr sdge 'php bin/console doctrine:generate:entity' 125 | abbr sdsc 'php bin/console doctrine:schema:create' 126 | abbr sdsu 'php bin/console doctrine:schema:update' 127 | abbr sdsv 'php bin/console doctrine:schema:validate' 128 | abbr sddc 'php bin/console doctrine:database:create' 129 | 130 | # Vagrant 131 | abbr v 'vagrant' 132 | abbr vu 'vagrant up' 133 | abbr vs 'vagrant ssh' 134 | abbr vp 'vagrant provision' 135 | abbr vr 'vagrant reload' 136 | abbr vrp 'vagrant reload --provision' 137 | abbr vh 'vagrant halt' 138 | 139 | # Other 140 | abbr pg 'pgrep -l' 141 | abbr psg 'ps -ef | grep' 142 | abbr ccat 'pygmentize -g' 143 | abbr add_to_path 'set -U fish_user_paths $fish_user_paths' 144 | abbr freebox_mount 'sudo mount -t cifs //mafreebox.freebox.fr/Disque\\ dur /media/freebox -o user=freebox,uid=1000,gid=1000,rw,password=' 145 | -------------------------------------------------------------------------------- /apache-skeleton.conf: -------------------------------------------------------------------------------- 1 | 2 | ServerAdmin contact@thicene.fr 3 | ServerName _DOMAIN_._TLD_ 4 | ServerAlias www._DOMAIN_._TLD_ 5 | 6 | DocumentRoot _DOCUMENT_ROOT_ 7 | DirectoryIndex index.php index.html 8 | 9 | LogLevel Error 10 | ErrorLog /var/log/apache2/_DOMAIN_-error.log 11 | CustomLog /var/log/apache2/_DOMAIN_-access.log Combined 12 | 13 | 14 | AllowOverride all 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /completions/composer.fish: -------------------------------------------------------------------------------- 1 | function __fish_print_composer_available_package 2 | 3 | set -l search_string (commandline -tc) 4 | 5 | switch $search_string 6 | case '-**' 7 | return 8 | end 9 | 10 | # List of composer package is slow, so we cache the result 11 | 12 | set cache_file /tmp/composer-packages 13 | 14 | if test -f $cache_file 15 | 16 | set age (math (date +%s) - (stat -c '%Y' $cache_file)) 17 | set max_age 300 18 | if test $age -gt $max_age 19 | command composer show -a -N > $cache_file 20 | end 21 | else 22 | command composer show -a -N > $cache_file 23 | end 24 | 25 | cat $cache_file | grep '^'$search_string 26 | end 27 | 28 | function __fish_print_composer_installed_package 29 | set -l search_string (commandline -tc) 30 | 31 | switch $search_string 32 | case '-**' 33 | return 34 | end 35 | 36 | command composer show -i -N | grep '^'$search_string 37 | end 38 | 39 | function __fish_composer_no_subcommand --description 'Test if composer has yet to be given the subcommand' 40 | for i in (commandline -opc) 41 | if contains -- $i about archive config create-project depends diagnose dumpautoload global help init install licenses list require run-script search selfupdate show status update validate 42 | return 1 43 | end 44 | end 45 | return 0 46 | end 47 | 48 | function __fish_composer_use_installed_package --description 'Test if composer command should have installed packages as potential completion' 49 | for i in (commandline -opc) 50 | if contains -- $i depends update 51 | return 0 52 | end 53 | end 54 | return 1 55 | end 56 | 57 | function __fish_composer_use_package --description 'Test if composer command should have packages as potential completion' 58 | 59 | for i in (commandline -opc) 60 | if contains -- $i require show create-project 61 | return 0 62 | end 63 | end 64 | return 1 65 | end 66 | 67 | function __fish_composer_json 68 | __fish_composer_no_subcommand 69 | and test -f composer.json 70 | end 71 | 72 | complete -c composer -n "__fish_composer_use_package" -f -a '(__fish_print_composer_available_package)' 73 | complete -c composer -n "__fish_composer_use_installed_package" -f -a '(__fish_print_composer_installed_package)' 74 | 75 | # COMPOSER OPTIONS 76 | complete -c composer -s h -l help --description "Display the help message" 77 | complete -c composer -s q -l quiet --description "Do not output any message" 78 | complete -c composer -s v -l verbose --description "Verbose output" 79 | complete -c composer -o vv --description "More verbose output" 80 | complete -c composer -o vvv --description "Debug output" 81 | complete -c composer -s V -l version --description "Display this application version" 82 | complete -c composer -l ansi --description "Force ANSI output" 83 | complete -c composer -l no-ansi --description "Disable ANSI output" 84 | complete -c composer -s n -l no-interaction --description "Do not ask any interactive question" 85 | complete -c composer -l profile --description "Display timing and memory usage information" 86 | complete -c composer -s d -l working-dir --description "If specified, use the given directory as working directory" 87 | 88 | # COMPOSER COMMANDS 89 | complete -c composer -f -a about -n "__fish_composer_no_subcommand" --description "Short information about Composer" 90 | complete -c composer -f -a archive -n "__fish_composer_json" --description "Create an archive of this composer package" 91 | complete -c composer -f -a config -n "__fish_composer_json" --description "Set config options" 92 | complete -c composer -f -a create-project -n "__fish_composer_no_subcommand" --description "Create new project from a package into given directory" 93 | complete -c composer -f -a depends -n "__fish_composer_json" --description "Shows which packages depend on the given package" 94 | complete -c composer -f -a diagnose -n "__fish_composer_no_subcommand" --description "Diagnoses the system to identify common errors" 95 | complete -c composer -f -a dumpautoload -n "__fish_composer_json" --description "Dumps the autoloader" 96 | complete -c composer -f -a global -n "__fish_composer_no_subcommand" --description "Allows running commands in the global composer dir (\$COMPOSER_HOME)" 97 | complete -c composer -f -a help -n "__fish_composer_no_subcommand" --description "Displays help for a command" 98 | complete -c composer -f -a init -n "__fish_composer_no_subcommand" --description "Creates a basic composer.json file in current directory" 99 | complete -c composer -f -a install -n "__fish_composer_json" --description "Installs the project dependencies from composer.lock if exists (else composer.json)" 100 | complete -c composer -f -a licenses -n "__fish_composer_json" --description "Show information about licenses of dependencies" 101 | complete -c composer -f -a list -n "__fish_composer_no_subcommand" --description "Lists commands" 102 | complete -c composer -f -a require -n "__fish_composer_no_subcommand" --description "Adds required packages to your composer.json and installs them" 103 | complete -c composer -f -a run-script -n "__fish_composer_no_subcommand" --description "Run the scripts defined in composer.json" 104 | complete -c composer -f -a search -n "__fish_composer_no_subcommand" --description "Search for packages" 105 | complete -c composer -f -a selfupdate -n "__fish_composer_no_subcommand" --description "Updates composer.phar to the latest version" 106 | complete -c composer -f -a show -n "__fish_composer_no_subcommand" --description "Show information about packages" 107 | complete -c composer -f -a status -n "__fish_composer_json" --description "Show a list of locally modified packages" 108 | complete -c composer -f -a update -n "__fish_composer_json" --description "Updates your dependencies to the latest version and updates the composer.lock file" 109 | complete -c composer -f -a validate -n "__fish_composer_json" --description "Validates a composer.json" 110 | 111 | # COMPOSER INIT COMMAND OPTIONS 112 | complete -c composer -l name -n "__fish_seen_subcommand_from init" --description "Name of the package" 113 | complete -c composer -l description -n "__fish_seen_subcommand_from init" --description "Description of the package" 114 | complete -c composer -l author -n "__fish_seen_subcommand_from init" --description "Author name of the package" 115 | complete -c composer -l homepage -n "__fish_seen_subcommand_from init" --description "Homepage of the package" 116 | complete -c composer -l require -n "__fish_seen_subcommand_from init" --description "Package to require with a version constraint. Should be in format foo/bar:1.0.0" 117 | complete -c composer -l require-dev -n "__fish_seen_subcommand_from init" --description "Development requirements, see --require" 118 | complete -c composer -s s -l stability -n "__fish_seen_subcommand_from init" --description "Value for the minimum-stability field" 119 | 120 | # COMPOSER INSTALL COMMAND OPTIONS 121 | complete -c composer -l prefer-source -n "__fish_seen_subcommand_from install" --description "Install package from source (vcs)" 122 | complete -c composer -l prefer-dist -n "__fish_seen_subcommand_from install" --description "Install package from dist" 123 | complete -c composer -l dry-run -n "__fish_seen_subcommand_from install" --description "Simulate the install" 124 | complete -c composer -l dev -n "__fish_seen_subcommand_from install" --description "Install packages listed in require-dev" 125 | complete -c composer -l no-dev -n "__fish_seen_subcommand_from install" --description "Skip packages listed in require-dev" 126 | complete -c composer -l no-scripts -n "__fish_seen_subcommand_from install" --description "Skips execution of scripts defined in composer.json" 127 | complete -c composer -l no-plugins -n "__fish_seen_subcommand_from install" --description "Disables plugins" 128 | complete -c composer -l no-progress -n "__fish_seen_subcommand_from install" --description "Removes the progress display that can mess with some terminals or scripts" 129 | complete -c composer -s o -l optimize-autoloader -n "__fish_seen_subcommand_from install" --description "Convert PSR-0/4 autoloading to classmap to get a faster autoloader" 130 | 131 | # COMPOSER UPDATE COMMAND OPTIONS 132 | complete -c composer -l prefer-source -n "__fish_seen_subcommand_from update" --description "Install package from source (vcs)" 133 | complete -c composer -l prefer-dist -n "__fish_seen_subcommand_from update" --description "Install package from dist" 134 | complete -c composer -l dry-run -n "__fish_seen_subcommand_from update" --description "Simulate the update" 135 | complete -c composer -l dev -n "__fish_seen_subcommand_from update" --description "Install packages listed in require-dev" 136 | complete -c composer -l no-dev -n "__fish_seen_subcommand_from update" --description "Skip packages listed in require-dev" 137 | complete -c composer -l no-scripts -n "__fish_seen_subcommand_from update" --description "Skips execution of scripts defined in composer.json" 138 | complete -c composer -l no-plugins -n "__fish_seen_subcommand_from update" --description "Disables plugins" 139 | complete -c composer -l no-progress -n "__fish_seen_subcommand_from update" --description "Removes the progress display that can mess with some terminals or scripts" 140 | complete -c composer -s o -l optimize-autoloader -n "__fish_seen_subcommand_from update" --description "Convert PSR-0/4 autoloading to classmap to get a faster autoloader" 141 | complete -c composer -l lock -n "__fish_seen_subcommand_from update" --description "Only updates the lock file hash to suppress warning about the lock file being out of date" 142 | complete -c composer -l with-dependencies -n "__fish_seen_subcommand_from update" --description "Add also all dependencies of whitelisted packages to the whitelist" 143 | 144 | # COMPOSER REQUIRE COMMAND OPTIONS 145 | complete -c composer -l prefer-source -n "__fish_seen_subcommand_from require" --description "Install package from source (vcs)" 146 | complete -c composer -l prefer-dist -n "__fish_seen_subcommand_from require" --description "Install package from dist" 147 | complete -c composer -l dev -n "__fish_seen_subcommand_from require" --description "Add packages to require-dev" 148 | complete -c composer -l no-updates -n "__fish_seen_subcommand_from require" --description "Disables the automatic update of the dependencies" 149 | complete -c composer -l no-progress -n "__fish_seen_subcommand_from require" --description "Removes the progress display that can mess with some terminals or scripts" 150 | complete -c composer -l update-with-dependencies -n "__fish_seen_subcommand_from require" --description "Also update dependencies of the newly required packages" 151 | 152 | # COMPOSER SEARCH COMMAND OPTIONS 153 | complete -c composer -s N -l only-name -n "__fish_seen_subcommand_from search" --description "Search only in name" 154 | 155 | # COMPOSER SHOW COMMAND OPTIONS 156 | complete -c composer -s i -l installed -n "__fish_seen_subcommand_from show" --description "List the packages that are installed" 157 | complete -c composer -s p -l platform -n "__fish_seen_subcommand_from show" --description "List only platform packages (php & extensions)" 158 | complete -c composer -s s -l self -n "__fish_seen_subcommand_from show" --description "List the root package info" 159 | 160 | # COMPOSER DEPENDS COMMAND OPTIONS 161 | complete -c composer -l link-type -n "__fish_seen_subcommand_from depends" --description "The link types (require, require-dev) to match on, can be specified multiple times" 162 | 163 | # COMPOSER VALIDATE COMMAND OPTIONS 164 | complete -c composer -l no-check-all -n "__fish_seen_subcommand_from validate" --description "Wether or not composer do a complete validation" 165 | 166 | # COMPOSER SELF UPDATE COMMAND OPTIONS 167 | complete -c composer -s r -l rollback -n "__fish_seen_subcommand_from selfupdate" --description "Rollback to the last version you had installed" 168 | complete -c composer -s r -l rollback -n "__fish_seen_subcommand_from self-update" --description "Rollback to the last version you had installed" 169 | complete -c composer -l clean-backups -n "__fish_seen_subcommand_from selfupdate" --description "Delete old backups during an update. This makes the current version of composer the only backup available after the update" 170 | complete -c composer -l clean-backups -n "__fish_seen_subcommand_from self-update" --description "Delete old backups during an update. This makes the current version of composer the only backup available after the update" 171 | 172 | # COMPOSER CONFIG COMMAND OPTIONS 173 | complete -c composer -s g -l global -n "__fish_seen_subcommand_from config" --description "Operate on the global config file located at \$COMPOSER_HOME/config.json" 174 | complete -c composer -s e -l editor -n "__fish_seen_subcommand_from config" --description "Open the local composer.json file using in a text editor as defined by the EDITOR env variable. With the --global option, this opens the global config file." 175 | complete -c composer -l unset -n "__fish_seen_subcommand_from config" --description "Remove the configuration element named by setting-key" 176 | complete -c composer -s l -l list -n "__fish_seen_subcommand_from config" --description "how the list of current config variables. With the --global option this lists the global configuration only" 177 | complete -c composer -s f -l file -n "__fish_seen_subcommand_from config" --description "Operate on a specific file instead of composer.json. Note that this cannot be used in conjunction with the --global option" 178 | 179 | # COMPOSER CREATE PROJECT COMMAND OPTIONS 180 | complete -c composer -l repository-url -n "__fish_seen_subcommand_from create-project" --description "" 181 | complete -c composer -s s -l stability -n "__fish_seen_subcommand_from create-project" --description "Minimum stability package. Defaults to stable" 182 | complete -c composer -l prefer-source -n "__fish_seen_subcommand_from create-project" --description "Install package from source (vcs)" 183 | complete -c composer -l prefer-dist -n "__fish_seen_subcommand_from create-project" --description "Install package from dist" 184 | complete -c composer -l dev -n "__fish_seen_subcommand_from create-project" --description "Install packages listed in require-dev" 185 | complete -c composer -l no-install -n "__fish_seen_subcommand_from create-project" --description "Disables installation of the vendors" 186 | complete -c composer -l no-scripts -n "__fish_seen_subcommand_from create-project" --description "Skips execution of scripts defined in the root package" 187 | complete -c composer -l no-plugins -n "__fish_seen_subcommand_from create-project" --description "Disables plugins" 188 | complete -c composer -l no-progress -n "__fish_seen_subcommand_from create-project" --description "Removes the progress display that can mess with some terminals or scripts" 189 | complete -c composer -l keep-vcs -n "__fish_seen_subcommand_from create-project" --description "Skip the deletion of the VCS metadata for the created project" 190 | 191 | # COMPOSER DUMP AUTOLOAD COMMAND OPTIONS 192 | complete -c composer -s o -l optimize -n "__fish_seen_subcommand_from dump-autoload" --description "Convert PSR-0/4 autoloading to classmap to get a faster autoloader" 193 | complete -c composer -l no-dev -n "__fish_seen_subcommand_from dump-autoload" --description "Disables the autoload-dev rules" 194 | 195 | # COMPOSER ARCHIVE COMMAND OPTIONS 196 | complete -c composer -s f -l format -n "__fish_seen_subcommand_from archive" --description "Format of the resulting archive: tar or zip" 197 | complete -c composer -l dir -n "__fish_seen_subcommand_from archive" --description "Write the archive to this directory" 198 | -------------------------------------------------------------------------------- /completions/git.fish: -------------------------------------------------------------------------------- 1 | #!fish 2 | # 3 | # git-flow-completion 4 | # =================== 5 | # 6 | # Fish completion support for [git-flow (AVH Edition)](http://github.com/petervanderdoes/gitflow) 7 | # 8 | # The contained completion routines provide support for completing: 9 | # 10 | # * git-flow init and version 11 | # * feature, hotfix and release branches 12 | # * remote feature, hotfix and release branch names 13 | # 14 | # 15 | # Installation 16 | # ------------ 17 | # 18 | # To achieve git-flow completion nirvana: 19 | # 20 | # 1. Install this file in your `~/.config/fish/completions` folder. 21 | # 22 | # 23 | # The Fine Print 24 | # -------------- 25 | # Author: 26 | # Copyright 2012 Peter van der Does. 27 | # 28 | # Original Author: 29 | # Copyright (c) 2012 [Justin Hileman](http://justinhileman.com) 30 | # 31 | # Distributed under the [MIT License](http://creativecommons.org/licenses/MIT/) 32 | 33 | for prefix in /usr /usr/local 34 | if test -f $prefix/share/fish/completions/git.fish 35 | . $prefix/share/fish/completions/git.fish 36 | break 37 | end 38 | end 39 | 40 | if not functions -q __fish_git_branches 41 | echo \nError: git completion not found >&2 42 | exit 43 | end 44 | 45 | ## Support functions 46 | 47 | function __fish_git_flow_using_command 48 | set cmd (commandline -opc) 49 | set subcommands 'flow' $argv 50 | if [ (count $cmd) = (math (count $subcommands) + 1) ] 51 | for i in (seq (count $subcommands)) 52 | if not test $subcommands[$i] = $cmd[(math $i + 1)] 53 | return 1 54 | end 55 | end 56 | return 0 57 | end 58 | return 1 59 | end 60 | 61 | function __fish_git_flow_prefix 62 | git config "gitflow.prefix.$argv[1]" 2> /dev/null; or echo "$argv[1]/" 63 | end 64 | 65 | function __fish_git_flow_branches 66 | set prefix (__fish_git_flow_prefix $argv[1]) 67 | __fish_git_branches | grep "^$prefix" | sed "s,^$prefix,," | sort 68 | end 69 | 70 | function __fish_git_flow_remote_branches 71 | set prefix (__fish_git_flow_prefix $argv[1]) 72 | set origin (git config gitflow.origin 2> /dev/null; or echo "origin") 73 | git branch -r 2> /dev/null | sed "s/^ *//g" | grep "^$origin/$prefix" | sed "s,^$origin/$prefix,," | sort 74 | end 75 | 76 | function __fish_git_flow_untracked_branches 77 | set branches (__fish_git_flow_branches $argv[1]) 78 | for branch in (__fish_git_flow_remote_branches $argv[1]) 79 | if not contains $branch $branches 80 | echo $branch 81 | end 82 | end 83 | end 84 | 85 | function __fish_git_flow_unpublished_branches 86 | set branches (__fish_git_flow_remote_branches $argv[1]) 87 | for branch in (__fish_git_flow_branches $argv[1]) 88 | if not contains $branch $branches 89 | echo $branch 90 | end 91 | end 92 | end 93 | 94 | 95 | ## git-flow 96 | 97 | complete -f -c git -n '__fish_git_needs_command' -a flow -d 'Manage a git-flow enabled repository' 98 | complete -f -c git -n '__fish_git_flow_using_command' -a version -d 'Show version information' 99 | 100 | 101 | 102 | ## git-flow init 103 | 104 | complete -f -c git -n '__fish_git_flow_using_command' -a init -d 'Initialize a new git repo with support for the branching model' 105 | complete -f -c git -n '__fish_git_flow_using_command init' -s f -d 'Force reinitialization' 106 | complete -f -c git -n '__fish_git_flow_using_command init' -s d -d 'Use default branch names' 107 | 108 | 109 | 110 | ## git-flow feature 111 | 112 | complete -f -c git -n '__fish_git_flow_using_command' -a feature -d 'Manage feature branches' 113 | complete -f -c git -n '__fish_git_flow_using_command feature' -a list -d 'List feature branches' 114 | complete -f -c git -n '__fish_git_flow_using_command feature' -s v -d 'Verbose output' 115 | 116 | complete -f -c git -n '__fish_git_flow_using_command feature' -a start -d 'Start a new feature branch' 117 | complete -f -c git -n '__fish_git_flow_using_command feature start' -s F -d 'Fetch from origin first' 118 | 119 | complete -f -c git -n '__fish_git_flow_using_command feature' -a finish -d 'Finish a feature branch' 120 | complete -f -c git -n '__fish_git_flow_using_command feature finish' -s F -d 'Fetch from origin first' 121 | complete -f -c git -n '__fish_git_flow_using_command feature finish' -s r -d 'Rebase instead of merging' 122 | complete -f -c git -n '__fish_git_flow_using_command feature finish' -a '(__fish_git_flow_branches feature)' -d 'Feature branch' 123 | 124 | complete -f -c git -n '__fish_git_flow_using_command feature' -a delete -d 'Delete a feature branch' 125 | complete -f -c git -n '__fish_git_flow_using_command feature delete' -s f -d 'Force deletion' 126 | complete -f -c git -n '__fish_git_flow_using_command feature delete' -s r -d 'Delete remote branch' 127 | complete -f -c git -n '__fish_git_flow_using_command feature delete' -a '(__fish_git_flow_branches feature)' -d 'Feature branch' 128 | 129 | complete -f -c git -n '__fish_git_flow_using_command feature' -a publish -d 'Publish a feature branch to remote' 130 | complete -f -c git -n '__fish_git_flow_using_command feature publish' -a '(__fish_git_flow_unpublished_branches feature)' -d 'Feature branch' 131 | 132 | complete -f -c git -n '__fish_git_flow_using_command feature' -a track -d 'Checkout remote feature branch' 133 | complete -f -c git -n '__fish_git_flow_using_command feature track' -a '(__fish_git_flow_untracked_branches feature)' -d 'Feature branch' 134 | 135 | complete -f -c git -n '__fish_git_flow_using_command feature' -a diff -d 'Show all changes' 136 | 137 | complete -f -c git -n '__fish_git_flow_using_command feature' -a rebase -d 'Rebase against integration branch' 138 | complete -f -c git -n '__fish_git_flow_using_command feature rebase' -s i -d 'Do an interactive rebase' 139 | 140 | complete -f -c git -n '__fish_git_flow_using_command feature' -a checkout -d 'Checkout local feature branch' 141 | complete -f -c git -n '__fish_git_flow_using_command feature checkout' -a '(__fish_git_flow_branches feature)' -d 'Feature branch' 142 | 143 | complete -f -c git -n '__fish_git_flow_using_command feature' -a pull -d 'Pull changes from remote' 144 | complete -f -c git -n '__fish_git_flow_using_command feature pull' -a '(__fish_git_remotes)' -d 'Remote' 145 | 146 | 147 | 148 | ## git-flow release 149 | 150 | complete -f -c git -n '__fish_git_flow_using_command' -a release -d 'Manage release branches' 151 | complete -f -c git -n '__fish_git_flow_using_command release' -a list -d 'List release branches' 152 | complete -f -c git -n '__fish_git_flow_using_command release' -s v -d 'Verbose output' 153 | 154 | complete -f -c git -n '__fish_git_flow_using_command release' -a start -d 'Start a new release branch' 155 | complete -f -c git -n '__fish_git_flow_using_command release start' -s F -d 'Fetch from origin first' 156 | 157 | complete -f -c git -n '__fish_git_flow_using_command release' -a finish -d 'Finish a release branch' 158 | complete -f -c git -n '__fish_git_flow_using_command release finish' -s F -d 'Fetch from origin first' 159 | complete -f -c git -n '__fish_git_flow_using_command release finish' -s s -d 'Sign the release tag cryptographically' 160 | complete -f -c git -n '__fish_git_flow_using_command release finish' -s u -d 'Use the given GPG-key for the digital signature (implies -s)' 161 | complete -f -c git -n '__fish_git_flow_using_command release finish' -s m -d 'Use the given tag message' 162 | complete -f -c git -n '__fish_git_flow_using_command release finish' -s p -d 'Push to $ORIGIN after performing finish' 163 | complete -f -c git -n '__fish_git_flow_using_command release finish' -a '(__fish_git_flow_branches release)' -d 'Release branch' 164 | 165 | complete -f -c git -n '__fish_git_flow_using_command release' -a delete -d 'Delete a feature branch' 166 | complete -f -c git -n '__fish_git_flow_using_command release delete' -s f -d 'Force deletion' 167 | complete -f -c git -n '__fish_git_flow_using_command release delete' -s r -d 'Delete remote branch' 168 | complete -f -c git -n '__fish_git_flow_using_command release delete' -a '(__fish_git_flow_branches release)' -d 'Release branch' 169 | 170 | complete -f -c git -n '__fish_git_flow_using_command release' -a publish -d 'Publish a release branch to remote' 171 | complete -f -c git -n '__fish_git_flow_using_command release publish' -a '(__fish_git_flow_unpublished_branches release)' -d 'Release branch' 172 | 173 | complete -f -c git -n '__fish_git_flow_using_command release' -a track -d 'Checkout remote release branch' 174 | complete -f -c git -n '__fish_git_flow_using_command release track' -a '(__fish_git_flow_untracked_branches release)' -d 'Release branch' 175 | 176 | 177 | 178 | ## git-flow hotfix 179 | 180 | complete -f -c git -n '__fish_git_flow_using_command' -a hotfix -d 'Manage hotfix branches' 181 | complete -f -c git -n '__fish_git_flow_using_command hotfix' -a list -d 'List hotfix branches' 182 | complete -f -c git -n '__fish_git_flow_using_command hotfix' -s v -d 'Verbose output' 183 | 184 | complete -f -c git -n '__fish_git_flow_using_command hotfix' -a start -d 'Start a new hotfix branch' 185 | complete -f -c git -n '__fish_git_flow_using_command hotfix start' -s F -d 'Fetch from origin first' 186 | 187 | complete -f -c git -n '__fish_git_flow_using_command hotfix' -a finish -d 'Finish a hotfix branch' 188 | complete -f -c git -n '__fish_git_flow_using_command hotfix finish' -s F -d 'Fetch from origin first' 189 | complete -f -c git -n '__fish_git_flow_using_command hotfix finish' -s s -d 'Sign the hotfix tag cryptographically' 190 | complete -f -c git -n '__fish_git_flow_using_command hotfix finish' -s u -d 'Use the given GPG-key for the digital signature (implies -s)' 191 | complete -f -c git -n '__fish_git_flow_using_command hotfix finish' -s m -d 'Use the given tag message' 192 | complete -f -c git -n '__fish_git_flow_using_command hotfix finish' -s p -d 'Push to $ORIGIN after performing finish' 193 | complete -f -c git -n '__fish_git_flow_using_command hotfix finish' -a '(__fish_git_flow_branches hotfix)' -d 'Hotfix branch' 194 | 195 | complete -f -c git -n '__fish_git_flow_using_command hotfix' -a delete -d 'Delete a feature branch' 196 | complete -f -c git -n '__fish_git_flow_using_command hotfix delete' -s f -d 'Force deletion' 197 | complete -f -c git -n '__fish_git_flow_using_command hotfix delete' -s r -d 'Delete remote branch' 198 | complete -f -c git -n '__fish_git_flow_using_command hotfix delete' -a '(__fish_git_flow_branches hotfix)' -d 'Hotfix branch' 199 | 200 | 201 | ## git-flow support 202 | 203 | complete -f -c git -n '__fish_git_flow_using_command' -a support -d 'Manage support branches' 204 | complete -f -c git -n '__fish_git_flow_using_command support' -a list -d 'List support branches' 205 | complete -f -c git -n '__fish_git_flow_using_command support' -s v -d 'Verbose output' 206 | 207 | complete -f -c git -n '__fish_git_flow_using_command support' -a start -d 'Start a new support branch' 208 | complete -f -c git -n '__fish_git_flow_using_command support start' -s F -d 'Fetch from origin first' 209 | 210 | ## git-flow config 211 | 212 | complete -f -c git -n '__fish_git_flow_using_command' -a config -d 'Manage configuration' 213 | complete -f -c git -n '__fish_git_flow_using_command config' -a list -d 'List configuration' 214 | complete -f -c git -n '__fish_git_flow_using_command config list' -l local -d 'Use repository config file' 215 | complete -f -c git -n '__fish_git_flow_using_command config list' -l global -d 'Use global config file' 216 | complete -f -c git -n '__fish_git_flow_using_command config list' -l system -d 'Use system config file' 217 | complete -f -c git -n '__fish_git_flow_using_command config list' -l file -d 'Use given config file' 218 | 219 | complete -f -c git -n '__fish_git_flow_using_command config' -a set -d 'Set configuration option' 220 | complete -f -c git -n '__fish_git_flow_using_command config start' -l local -d 'Use repository config file' 221 | complete -f -c git -n '__fish_git_flow_using_command config start' -l global -d 'Use global config file' 222 | complete -f -c git -n '__fish_git_flow_using_command config start' -l system -d 'Use system config file' 223 | complete -f -c git -n '__fish_git_flow_using_command config start' -l file -d 'Use given config file' 224 | -------------------------------------------------------------------------------- /completions/gitignore.fish: -------------------------------------------------------------------------------- 1 | function __gitignore_list 2 | curl -L -s https://www.gitignore.io/api/list | sed "s/,/ /g" 3 | end 4 | 5 | complete -f -A -c gitignore -a (__gitignore_list) 6 | -------------------------------------------------------------------------------- /conf.d/nerd-fonts.fish: -------------------------------------------------------------------------------- 1 | set -g theme_nerd_fonts yes 2 | -------------------------------------------------------------------------------- /conf.d/omf.fish: -------------------------------------------------------------------------------- 1 | # Path to Oh My Fish install. 2 | set -q XDG_DATA_HOME 3 | and set -gx OMF_PATH "$XDG_DATA_HOME/omf" 4 | or set -gx OMF_PATH "$HOME/.local/share/omf" 5 | 6 | # Load Oh My Fish configuration. 7 | source $OMF_PATH/init.fish 8 | -------------------------------------------------------------------------------- /config.fish: -------------------------------------------------------------------------------- 1 | set --export SHELL /usr/bin/fish 2 | set --export EDITOR "subl -w" 3 | set -e fish_greeting 4 | 5 | if [ -f /usr/share/autojump/autojump.fish ] 6 | source /usr/share/autojump/autojump.fish 7 | end 8 | 9 | source "$HOME/.config/fish/abbreviations.fish" 10 | -------------------------------------------------------------------------------- /functions/__byscripts_ask.fish: -------------------------------------------------------------------------------- 1 | #doc 2 | # `__byscripts_ask $question`: Ask the user a `$question` and echoes the answer 3 | #enddoc 4 | 5 | function __byscripts_ask --description "Ask the user a question" 6 | set -q argv[1]; and set -l question $argv[1] 7 | set -q argv[2]; and set -l default_value $argv[2] 8 | read -l -c "$default_value" -p "set_color green; echo -n '$question'; set_color normal; echo '> ';" tmp 9 | echo $tmp 10 | end 11 | -------------------------------------------------------------------------------- /functions/__byscripts_blue.fish: -------------------------------------------------------------------------------- 1 | #doc 2 | # `__byscripts_blue $string`: Echoes `$string` in blue color 3 | # 4 | # Arguments passed to `__byscripts_blue` are propagated to `echo` 5 | #enddoc 6 | 7 | function __byscripts_blue -d "Echoes in blue" 8 | set_color -o blue; echo $argv; set_color normal 9 | end 10 | -------------------------------------------------------------------------------- /functions/__byscripts_confirm.fish: -------------------------------------------------------------------------------- 1 | #doc 2 | # `__byscripts_confirm $string`: Ask the user to confirm (output: `$string [Yn]`) 3 | # 4 | # Return `0` (Y) or `1` (N) status to use with control structure (`if`, `while`...) 5 | #enddoc 6 | 7 | function __byscripts_confirm -d "Ask the user a confirmation" 8 | while true 9 | set confirmation (__byscripts_ask "$argv [Yn]") 10 | switch $confirmation 11 | case '' y Y 12 | return 0 13 | case n N 14 | return 1 15 | end 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /functions/__byscripts_green.fish: -------------------------------------------------------------------------------- 1 | #doc 2 | # `__byscripts_green $string`: Echoes `$string` in green color 3 | # 4 | # Arguments passed to `__byscripts_green` are propagated to `echo` 5 | #enddoc 6 | 7 | function __byscripts_green -d "Echoes in green" 8 | set_color -o green; echo $argv; set_color normal 9 | end 10 | -------------------------------------------------------------------------------- /functions/__byscripts_red.fish: -------------------------------------------------------------------------------- 1 | #doc 2 | # `__byscripts_red $string`: Echoes `$string` in red color 3 | # 4 | # Arguments passed to `__byscripts_red` are propagated to `echo` 5 | #enddoc 6 | 7 | function __byscripts_red -d "Echoes in red" 8 | set_color -o red; echo $argv; set_color normal 9 | end 10 | -------------------------------------------------------------------------------- /functions/__byscripts_spinner.fish: -------------------------------------------------------------------------------- 1 | #doc 2 | # `__byscripts_spinner $pid`: Display a spinner while the process with PID `$pid` is running 3 | #enddoc 4 | 5 | # Inspired by: http://fitnr.com/showing-a-bash-spinner.html 6 | 7 | function __byscripts_spinner --description 'Display a spinner while a process is running' --argument pid 8 | set -l delay 0.5 9 | set -l spinstr \| \/ \- \\ 10 | set -l index 1 11 | 12 | while ps x | awk '{print $1}' | grep $pid > /dev/null 2>&1 13 | 14 | printf " [%c] " $spinstr[$index] 15 | sleep $delay 16 | printf "\b\b\b\b\b\b" 17 | 18 | set index (expr $index + 1) 19 | 20 | if [ $index -eq 5 ] 21 | set index 1 22 | end 23 | end 24 | 25 | printf " \b\b\b\b" 26 | end 27 | -------------------------------------------------------------------------------- /functions/add_to_hosts.fish: -------------------------------------------------------------------------------- 1 | #doc 2 | # `add_to_hosts `: Ask for an IP address (defaults to 127.0.0.1) and add `hostname` to /etc/hosts file. 3 | #enddoc 4 | 5 | function add_to_hosts -d "Add hostname(s) to /etc/hosts" 6 | set _ip (__byscripts_ask "Enter IP address [127.0.0.1]") 7 | 8 | if test -n "$argv" 9 | set _hostnames "$argv" 10 | else 11 | set _hostnames (__byscripts_ask "Enter hostnames") 12 | end 13 | 14 | if test -z $_ip 15 | set _ip "127.0.0.1" 16 | end 17 | 18 | echo -n "Do you confirm adding "(__byscripts_blue -n "$_ip $_hostnames")" to "(__byscripts_blue -n "/etc/hosts")"?" 19 | 20 | if __byscripts_confirm 21 | echo "$_ip $_hostnames" | sudo tee -a /etc/hosts 22 | __byscripts_green "Hostname has been added to you hosts file." 23 | else 24 | __byscripts_red "Nothing has been added to your hosts file." 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /functions/create-domain.fish: -------------------------------------------------------------------------------- 1 | #doc 2 | # `create-domain foobar.tld` : 3 | # 4 | # * Create a `foobar.tld.conf` Apache file pointing to `/var/www/foobar.tld` 5 | # * Create a `foobar-tld` MySQL database 6 | # * Create a `foobar-tld` MySQL user 7 | # * Grant all access on created database to created user 8 | #enddoc 9 | 10 | function create-domain -d "Create a new domain configuration" 11 | set _fqdn $argv[1] 12 | set _domain (echo $_fqdn | cut -f1 -d.) 13 | set _documentRoot "/var/www/$_fqdn/web" 14 | set _tld (echo $_fqdn | cut -f2 -d.) 15 | set _filename (echo /etc/apache2/sites-available/$_fqdn.conf) 16 | set _database (echo $_fqdn | sed "s/\\./-/g" | sed "s/[^a-z0-9-]//g") 17 | set _password (python -c 'import string; import random; print "".join(random.choice(string.ascii_uppercase + string.ascii_lowercase + string.digits) for _ in range(20))') 18 | set _doSomething 0 19 | set _doApache 0 20 | set _doDatabase 0 21 | set _doDatabaseUser 0 22 | set _doMySql 0 23 | 24 | if __byscripts_confirm "Configure MySQL user/database?" 25 | set _doMySql 1 26 | __byscripts_blue -n "Enter you MySQL root password: " 27 | stty -echo 28 | head -n 1 | read -l _tmpPassword 29 | set _rootPassword $_tmpPassword 30 | stty echo 31 | echo 32 | end 33 | 34 | if test -e $_filename 35 | echo 36 | echo (__byscripts_blue -n "> WARNING")": Apache config file "(__byscripts_green -n $_filename)" already exists. This step will be skipped." 37 | else 38 | if __byscripts_confirm "Create Apache config file?" 39 | echo 40 | echo "> Apache config file will be created: "(__byscripts_green -n $_filename) 41 | set _documentRoot (__byscripts_ask "Document root" "$_documentRoot") 42 | set _doApache 1 43 | set _doSomething 1 44 | end 45 | end 46 | 47 | if test $_doMySql = 1 48 | if mysql -uroot -p$_rootPassword -N -B -e "SELECT EXISTS(SELECT 1 FROM mysql.db WHERE Db = '$_database')" | grep -q -E '1' 49 | echo 50 | echo (__byscripts_blue -n "> WARNING")": Database "(__byscripts_green -n $_database)" already exists. This step will be skipped." 51 | else 52 | echo 53 | echo "> Database will be created: "(__byscripts_green -n $_database) 54 | set _doDatabase 1 55 | set _doSomething 1 56 | end 57 | 58 | if mysql -uroot -p$_rootPassword -N -B -e "SELECT EXISTS(SELECT 1 FROM mysql.user WHERE user = '$_database')" | grep -q -E '1' 59 | echo 60 | echo (__byscripts_blue -n "> WARNING")": Database user "(__byscripts_green -n $_database)" already exists. This step will be skipped." 61 | else 62 | echo 63 | echo "> Database user will be created: "(__byscripts_green -n $_database) 64 | set _doDatabaseUser 1 65 | set _doSomething 1 66 | end 67 | end 68 | 69 | if test $_doSomething = 0 70 | echo 71 | __byscripts_red "Nothing to do. Abort." 72 | echo 73 | return 74 | end 75 | 76 | echo 77 | 78 | if not __byscripts_confirm "Continue?" 79 | echo 80 | __byscripts_red "Aborted." 81 | return 82 | end 83 | 84 | if test $_doApache = 1 85 | sudo cp $HOME/.config/fish/apache-skeleton.conf $_filename 86 | sudo sed -i "s#_DOCUMENT_ROOT_#$_documentRoot#g" $_filename 87 | sudo sed -i "s/_DOMAIN_/$_domain/g" $_filename 88 | sudo sed -i "s/_TLD_/$_tld/g" $_filename 89 | __byscripts_green "Apache config file has been created." 90 | end 91 | 92 | if test $_doMySql = 1 93 | if test $_doDatabaseUser = 1 94 | mysql -uroot -p$_rootPassword -e "CREATE USER '$_database'@'localhost' IDENTIFIED BY '$_password';" 95 | __byscripts_green "Database user has been created with password: "(__byscripts_blue -n $_password) 96 | end 97 | 98 | if test $_doDatabase = 1 99 | mysql -uroot -p$_rootPassword -e "CREATE DATABASE IF NOT EXISTS `$_database` CHARACTER SET utf8 COLLATE utf8_general_ci;" 100 | __byscripts_green "Database has been created." 101 | end 102 | 103 | mysql -uroot -p$_rootPassword -e "GRANT ALL ON `$_database`.* TO '$_database'@'localhost';FLUSH PRIVILEGES;" 104 | __byscripts_green "User's permissions on database have been updated." 105 | 106 | echo 107 | end 108 | 109 | if test $_doApache = 1 110 | if __byscripts_confirm "Do you want to activate the website (a2ensite)?" 111 | sudo a2ensite $_fqdn > /dev/null 112 | __byscripts_green "Website has been activated." 113 | 114 | if __byscripts_confirm "Do you want to reload the Apache config (service apache2 reload)?" 115 | sudo service apache2 reload > /dev/null 116 | __byscripts_green "Apache config has been reloaded." 117 | end 118 | else 119 | __byscripts_red "Website has not been activated." 120 | end 121 | end 122 | 123 | if not grep -q "$_fqdn" /etc/hosts 124 | if __byscripts_confirm "Do you want to add $_fqdn to you hosts file?" 125 | add_to_hosts "$_fqdn" 126 | end 127 | end 128 | end 129 | -------------------------------------------------------------------------------- /functions/delete-domain.fish: -------------------------------------------------------------------------------- 1 | #doc 2 | # `delete-domain foobar.tld` : Reverse the `create-domain` process. Delete MySQL user, database and Apache config. 3 | #enddoc 4 | 5 | function delete-domain --description 'Delete a domain configuration' 6 | set _fqdn $argv[1] 7 | set _domain (echo $_fqdn | cut -f1 -d.) 8 | set _tld (echo $_fqdn | cut -f2 -d.) 9 | set _filename (echo /etc/apache2/sites-available/$_fqdn.conf) 10 | set _database (echo $_fqdn | sed "s/\\./-/g" | sed "s/[^a-z0-9-]//g") 11 | set _doSomething 0 12 | set _doApache 0 13 | set _doDatabase 0 14 | set _doDatabaseUser 0 15 | set _doMySql 0 16 | 17 | if __byscripts_confirm "Drop MySQL user/database?" 18 | set _doMySql 1 19 | __byscripts_blue -n "Enter you MySQL root password: " 20 | stty -echo 21 | head -n 1 | read -l _tmpPassword 22 | set _rootPassword $_tmpPassword 23 | stty echo 24 | echo 25 | end 26 | 27 | if test -e $_filename 28 | echo 29 | echo "> Apache config file will be deleted: "(__byscripts_green -n $_filename) 30 | set _doApache 1 31 | set _doSomething 1 32 | else 33 | echo 34 | echo (__byscripts_blue -n "> WARNING")": Apache config file "(__byscripts_green -n $_filename)" does not exists. This step will be skipped." 35 | end 36 | 37 | if test $_doMySql = 1 38 | if mysql -uroot -p$_rootPassword -N -B -e "SELECT EXISTS(SELECT 1 FROM mysql.db WHERE Db = '$_database')" | grep -q -E '1' 39 | echo 40 | echo "> Database will be deleted: "(__byscripts_green -n $_database) 41 | set _doDatabase 1 42 | set _doSomething 1 43 | else 44 | echo 45 | echo (__byscripts_blue -n "> WARNING")": Database "(__byscripts_green -n $_database)" does not exists. This step will be skipped." 46 | end 47 | 48 | if mysql -uroot -p$_rootPassword -N -B -e "SELECT EXISTS(SELECT 1 FROM mysql.user WHERE user = '$_database')" | grep -q -E '1' 49 | echo 50 | echo "> Database user will be deleted: "(__byscripts_green -n $_database) 51 | set _doDatabaseUser 1 52 | set _doSomething 1 53 | else 54 | echo 55 | echo (__byscripts_blue -n "> WARNING")": Database user "(__byscripts_green -n $_database)" does not exists. This step will be skipped." 56 | end 57 | end 58 | 59 | if test $_doSomething = 0 60 | echo 61 | __byscripts_red "Nothing to do. Abort." 62 | echo 63 | return 64 | end 65 | 66 | echo 67 | 68 | if not __byscripts_confirm "Continue?" 69 | echo 70 | __byscripts_green "Aborted." 71 | return 72 | end 73 | 74 | if test $_doApache = 1 75 | sudo a2dissite $_fqdn > /dev/null 76 | __byscripts_green "Website has been deactivated" 77 | sudo rm $_filename 78 | __byscripts_green "Apache config file has been deleted." 79 | end 80 | 81 | if test $_doMySql = 1 82 | if test $_doDatabaseUser = 1 83 | mysql -uroot -p$_rootPassword -e "DROP USER '$_database'@'localhost';" 84 | __byscripts_green "Database user has been deleted." 85 | end 86 | 87 | if test $_doDatabase = 1 88 | mysql -uroot -p$_rootPassword -e "DROP DATABASE IF EXISTS `$_database`;" 89 | __byscripts_green "Database has been deleted." 90 | end 91 | 92 | mysql -uroot -p$_rootPassword -e "FLUSH PRIVILEGES;" 93 | __byscripts_green "MySQL permissions have been updated." 94 | end 95 | 96 | if test $_doApache = 1 97 | if __byscripts_confirm "Do you want to reload Apache config (service apache2 reload)?" 98 | sudo service apache2 reload > /dev/null 99 | __byscripts_green "Apache config has been reloaded" 100 | end 101 | end 102 | end 103 | -------------------------------------------------------------------------------- /functions/fish_prompt.fish: -------------------------------------------------------------------------------- 1 | function __byscripts_decrease_remaining_length 2 | set -g _byscripts_remaining_length (expr $_byscripts_remaining_length - $argv) 3 | end 4 | 5 | function __byscripts_decorate 6 | 7 | __byscripts_decrease_remaining_length (expr (expr length $argv[1]) + 6) 8 | echo -n "─◁ " 9 | 10 | if [ (count $argv) -gt 1 ] 11 | set_color $argv[2..(count $argv)] 12 | end 13 | 14 | echo -n $argv[1] 15 | set_color $fish_color_normal 16 | echo -n " ▷─" 17 | end 18 | 19 | function __byscripts_prompt_date 20 | __byscripts_decorate (date +%H:%M:%S) "cc0" 21 | end 22 | 23 | function __byscripts_prompt_hostname 24 | set -l whoami (whoami)"@"(hostname) 25 | if [ (whoami) = 'root' ] 26 | __byscripts_decorate $whoami "red" "--underline" 27 | else 28 | __byscripts_decorate $whoami "cyan" 29 | end 30 | end 31 | 32 | function __byscripts_prompt_git 33 | 34 | set -g __fish_git_prompt_show_informative_status 1 35 | set -g __fish_git_prompt_showcolorhints 1 36 | set -g __fish_git_prompt_char_stateseparator " " 37 | 38 | set -l prompt (__fish_git_prompt "%s") 39 | 40 | if [ -n "$prompt" ] 41 | __byscripts_decrease_remaining_length -18 42 | __byscripts_decorate $prompt 43 | end 44 | end 45 | 46 | function __byscripts_prompt_cwd 47 | __byscripts_decorate (prompt_pwd) yellow 48 | end 49 | 50 | function __byscripts_prompt_fish 51 | __byscripts_decorate '><(((°>' blue 52 | end 53 | 54 | function fish_prompt 55 | set -g _byscripts_remaining_length (expr $COLUMNS) 56 | 57 | echo -n "┌" 58 | 59 | __byscripts_prompt_cwd 60 | __byscripts_prompt_git 61 | __byscripts_prompt_hostname 62 | __byscripts_prompt_date 63 | __byscripts_prompt_fish 64 | 65 | printf "%"$_byscripts_remaining_length"s\n" | sed -e "s| |─|g" 66 | 67 | echo "└─▶ " 68 | end 69 | -------------------------------------------------------------------------------- /functions/gitignore.fish: -------------------------------------------------------------------------------- 1 | #doc 2 | # `gitignore app1 app2 ... >> .gitignore`: Create a .gitignore from www.gitignore.io 3 | # Get a list of applications with `gitignore list` or simply press TAB to get autocompletion 4 | #enddoc 5 | 6 | function gitignore --description 'Generate a .gitignore file from gitignore.io' 7 | if count $argv > /dev/null 8 | curl -L -s https://www.gitignore.io/api/$argv 9 | else 10 | echo "Usage: gi choice1,choice2,choiceN >> .gitignore" 11 | echo "" 12 | echo "To get a list of possible choices: gi list" 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /functions/make_completion.fish: -------------------------------------------------------------------------------- 1 | function make_completion --argument alias command 2 | complete -c $alias -xa "( 3 | set -l cmd (commandline -pc | sed -e 's/^ *\S\+ *//' ); 4 | complete -C\"$command \$cmd\"; 5 | )" 6 | end 7 | -------------------------------------------------------------------------------- /functions/mkcd.fish: -------------------------------------------------------------------------------- 1 | #doc 2 | # `mkcd foo/bar/baz`: Runs `mkdir foo/bar/baz` then `cd foo/bar/baz` 3 | #enddoc 4 | 5 | function mkcd --description 'Creates a directory then "cd" to it' 6 | mkdir -p "$argv[1]" 7 | cd "$argv[1]" 8 | end 9 | -------------------------------------------------------------------------------- /functions/mongochef-update.fish: -------------------------------------------------------------------------------- 1 | #doc 2 | # `mongochef-update `: 3 | # 4 | # * Copy the current `~/Applications/MongoChef` to `~/Applications/MongoChef-{timestamp}` 5 | # * Download MongoChef from `` 6 | # * Extract archive to `~/Applications/MongoChef` 7 | #enddoc 8 | 9 | function mongochef-update -a url 10 | 11 | if test -z $url 12 | __byscripts_red "Usage: mongochef-update " 13 | return 14 | end 15 | 16 | echo -n "Downloading $url... " 17 | set -l MONGOCHEF_FILENAME (basename "$url") 18 | 19 | rm -f "/tmp/$MONGOCHEF_FILENAME" 20 | 21 | echo -n " " 22 | command wget -P "/tmp" --progress=dot $url 2>&1 | command grep --line-buffered "%" | command sed -u -e "s,\.,,g" | command awk '{printf("\b\b\b\b%4s", $2)}' 23 | echo -ne "\b\b\b\b" 24 | __byscripts_green "OK" 25 | 26 | if test -d "$HOME/Applications/MongoChef" 27 | set -l TODAY (date +"%Y-%m-%d-%H-%M") 28 | mv "$HOME/Applications/MongoChef" "$HOME/Applications/MongoChef-$TODAY" 29 | end 30 | 31 | mkdir -p "$HOME/Applications/MongoChef" 32 | 33 | echo -n "Extracting $MONGOCHEF_FILENAME... " 34 | tar --strip-components=1 -C "$HOME/Applications/MongoChef" -xzf "/tmp/$MONGOCHEF_FILENAME" 35 | __byscripts_green "OK" 36 | end 37 | -------------------------------------------------------------------------------- /functions/php-symlink-remove.fish: -------------------------------------------------------------------------------- 1 | #doc 2 | # Remove the symlinks and copy `apache2/php.ini` back to `cli/php.ini` and `cgi/php.ini` 3 | #enddoc 4 | 5 | function php-symlink-remove --description 'Turn Php5 php.ini syminks to regular files' 6 | if test -d /etc/php5/cli 7 | echo "Removing Php5 CLI php.ini symlink" 8 | sudo rm /etc/php5/cli/php.ini 9 | 10 | echo "Copy Apache2 php.ini to CLI php.ini" 11 | sudo cp /etc/php5/apache2/php.ini /etc/php5/cli/php.ini 12 | end 13 | 14 | if test -d /etc/php5/cgi 15 | echo "Removing Php5 CGI php.ini symlink" 16 | sudo rm /etc/php5/cgi/php.ini 17 | 18 | echo "Copy Apache2 php.ini to CGI php.ini" 19 | sudo cp /etc/php5/apache2/php.ini /etc/php5/cgi/php.ini 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /functions/php-symlink.fish: -------------------------------------------------------------------------------- 1 | #doc 2 | # Remove `cli/php.ini` and `cgi/php.ini`, and symlink `apache2/php.ini` instead 3 | #enddoc 4 | 5 | function php-symlink --description 'Turn Php5 php.ini regular files to symlinks' 6 | if test -d /etc/php5/cli 7 | echo "Removing Php5 CLI php.ini" 8 | sudo rm /etc/php5/cli/php.ini 9 | 10 | echo "Symlink Apache2 php.ini to CLI php.ini" 11 | sudo ln -s /etc/php5/apache2/php.ini /etc/php5/cli/php.ini 12 | end 13 | 14 | if test -d /etc/php5/cgi 15 | echo "Removing Php5 CGI php.ini" 16 | sudo rm /etc/php5/cgi/php.ini 17 | 18 | echo "Symlink Apache2 php.ini to CGI php.ini" 19 | sudo ln -s /etc/php5/apache2/php.ini /etc/php5/cgi/php.ini 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /functions/phpstorm-update.fish: -------------------------------------------------------------------------------- 1 | #doc 2 | # `phpstorm-update `: 3 | # 4 | # * Copy the current `~/Applications/PhpStorm` to `~/Applications/PhpStorm-{timestamp}` 5 | # * Download PhpStorm from `` 6 | # * Extract archive to `~/Applications/PhpStorm` 7 | #enddoc 8 | 9 | function phpstorm-update -a url 10 | 11 | if test -z $url 12 | __byscripts_red "Usage: phpstorm-update " 13 | return 14 | end 15 | 16 | echo -n "Downloading $url... " 17 | set -l STORM_FILENAME (basename "$url") 18 | 19 | rm -f "/tmp/$STORM_FILENAME" 20 | 21 | echo -n " " 22 | command wget -P "/tmp" --progress=dot $url 2>&1 | command grep --line-buffered "%" | command sed -u -e "s,\.,,g" | command awk '{printf("\b\b\b\b%4s", $2)}' 23 | echo -ne "\b\b\b\b" 24 | __byscripts_green "OK" 25 | 26 | if test -d "$HOME/Applications/PhpStorm" 27 | set -l TODAY (date +"%Y-%m-%d-%H-%M") 28 | mv "$HOME/Applications/PhpStorm" "$HOME/Applications/PhpStorm-$TODAY" 29 | end 30 | 31 | mkdir -p "$HOME/Applications/PhpStorm" 32 | 33 | echo -n "Extracting $STORM_FILENAME... " 34 | tar --strip-components=1 -C "$HOME/Applications/PhpStorm" -xzf "/tmp/$STORM_FILENAME" 35 | __byscripts_green "OK" 36 | end 37 | -------------------------------------------------------------------------------- /functions/symfo-acl.fish: -------------------------------------------------------------------------------- 1 | #doc 2 | # Set correct ACL for a Symfony app. 3 | # Create `app/cache` and `app/log` if not exist, then set ACL to `www-data` and current user. 4 | #enddoc 5 | 6 | function symfo-acl --description 'Configure ACL on app/cache and app/logs' 7 | sudo mkdir -p app/cache app/logs 8 | sudo setfacl -R -m u:www-data:rwX -m u:(whoami):rwX app/cache app/logs 9 | sudo setfacl -dR -m u:www-data:rwx -m u:(whoami):rwx app/cache app/logs 10 | end 11 | -------------------------------------------------------------------------------- /functions/symfo3-acl.fish: -------------------------------------------------------------------------------- 1 | #doc 2 | # Set correct ACL for a Symfony 3 app. 3 | # Create `var` if not exist, then set ACL to `www-data` and current user. 4 | #enddoc 5 | 6 | function symfo3-acl --description 'Configure ACL on var directory' 7 | sudo mkdir -p var 8 | sudo setfacl -R -m u:www-data:rwX -m u:(whoami):rwX var 9 | sudo setfacl -dR -m u:www-data:rwx -m u:(whoami):rwx var 10 | end 11 | -------------------------------------------------------------------------------- /update_doc: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | $commands) { 33 | 34 | $line = [ 35 | ' ' . $groupLabel . '', 36 | ' ' 37 | ]; 38 | foreach ($commands as $abbr => $command) { 39 | $line[] = ' ' . $abbr . '' . trim($command, '\'') . ''; 40 | } 41 | $line[] = ' '; 42 | 43 | $lines[] = implode("\n", $line); 44 | } 45 | 46 | $startTag = '[//]: # (abbreviations)'; 47 | $endTag = '[//]: # (/abbreviations)'; 48 | 49 | $output = $startTag . "\n\n"; 50 | $output .= '' . "\n"; 51 | $output .= implode("\n \n", $lines); 52 | $output .= "\n" . '
'; 53 | $output .= "\n\n" . $endTag; 54 | 55 | $readmeContent = preg_replace( 56 | sprintf('`^%s.*%s$`sm', preg_quote($startTag), preg_quote($endTag)), 57 | $output, 58 | $readmeContent 59 | ); 60 | 61 | /** 62 | * PARSE COMMANDS 63 | */ 64 | 65 | $lines = []; 66 | 67 | foreach (scandir(__DIR__ . '/functions') as $fileName) { 68 | 69 | $filePath = __DIR__ . '/functions/' . $fileName; 70 | 71 | if (!is_file($filePath)) { 72 | continue; 73 | } 74 | 75 | $fileContent = file_get_contents($filePath); 76 | 77 | if (!preg_match('`^#doc(.*)#enddoc$`ms', $fileContent, $match)) { 78 | continue; 79 | } 80 | 81 | $lines[] = ''; 82 | $lines[] = '#### ' . basename($fileName, '.fish'); 83 | $lines[] = ''; 84 | $lines[] = preg_replace('`^# ?`m', '', trim($match[1])); 85 | } 86 | 87 | $startTag = '[//]: # (commands)'; 88 | $endTag = '[//]: # (/commands)'; 89 | 90 | array_unshift($lines, $startTag); 91 | array_push($lines, '', $endTag); 92 | 93 | $readmeContent = preg_replace( 94 | sprintf('`^%s.*%s$`sm', preg_quote($startTag), preg_quote($endTag)), 95 | implode("\n", $lines), 96 | $readmeContent 97 | ); 98 | 99 | /** 100 | * WRITE NEW README 101 | */ 102 | 103 | 104 | file_put_contents($readmeFilePath, $readmeContent); 105 | --------------------------------------------------------------------------------