if cp --version ^ /dev/null > /dev/null # GNU complete -c cp -s a -l archive -d "Same as -dpR" complete -c cp -s b -l backup -d "Make backup of each existing destination file" -a "none off numbered t existing nil simple never" complete -c cp -l copy-contents -d "Copy contents of special files when recursive" complete -c cp -s d -d "Same as --no-dereference --preserve=link" complete -c cp -s f -l force -d "Do not prompt before overwriting" complete -c cp -s i -l interactive -d "Prompt before overwrite" complete -c cp -s H -d "Follow command-line symbolic links" complete -c cp -s l -l link -d "Link files instead of copying" complete -c cp -l strip-trailing-slashes -d "Remove trailing slashes from source" complete -c cp -s S -l suffix -r -d "Backup suffix" complete -c cp -s t -l target-directory -d "Target directory" -x -a "(__fish_complete_directories (commandline -ct) 'Target directory')" complete -c cp -s u -l update -d "Do not overwrite newer files" complete -c cp -s v -l verbose -d "Verbose mode" complete -c cp -l help -d "Display help and exit" complete -c cp -l version -d "Display version and exit" complete -c cp -s L -l dereference -d "Always follow symbolic links" complete -c cp -s P -l no-dereference -d "Never follow symbolic links" complete -c cp -s p -d "Same as --preserve=mode,ownership,timestamps" complete -c cp -f -l preserve -d "Preserve ATTRIBUTES if possible" -xa "mode ownership timestamps links all" complete -c cp -f -l no-preserve -r -d "Don't preserve ATTRIBUTES" -xa "mode ownership timestamps links all" complete -c cp -l parents -d "Use full source file name under DIRECTORY" complete -c cp -s r -s R -l recursive -d "Copy directories recursively" complete -c cp -l remove-destination -d "First remove existing destination files" complete -c cp -f -l sparse -r -d "Control creation of sparse files" -xa "always auto never" complete -c cp -s s -l symbolic-link -d "Make symbolic links instead of copying" complete -c cp -s T -l no-target-directory -d "Treat DEST as a normal file" complete -c cp -s x -l one-file-system -d "Stay on this file system" complete -c cp -s X -l context -r -d "Set security context of copy to CONTEXT" else # OS X complete -c cp -s a -d "Preserve structure and attributes of files but not directory structure. (-pPR)" complete -c cp -s f -d "Replace destination file without confirmation" complete -c cp -s H -d "Follow symlinks on command-link" complete -c cp -s i -d "Prompt before overwrite" complete -c cp -s L -d "Follow all symlinks" complete -c cp -s n -d "Do overwrite existing files" complete -c cp -s P -d "Don't follow symlinks (default)" complete -c cp -s p -d "Preserve attributes of source file" complete -c cp -s R -d "Copy directories recursively" complete -c cp -s v -d "Verbos output" complete -c cp -s X -d "Do not copy Extended Attributes (EAs) of resource forks" end