2020-01-09 20:05:31 +00:00
|
|
|
import * as core from '@actions/core'
|
|
|
|
import {GlobOptions} from './internal-glob-options'
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a copy with defaults filled in.
|
|
|
|
*/
|
|
|
|
export function getOptions(copy?: GlobOptions): GlobOptions {
|
|
|
|
const result: GlobOptions = {
|
|
|
|
followSymbolicLinks: true,
|
|
|
|
implicitDescendants: true,
|
2021-06-01 19:57:03 +00:00
|
|
|
matchDirectories: true,
|
2020-01-09 20:05:31 +00:00
|
|
|
omitBrokenSymbolicLinks: true
|
|
|
|
}
|
|
|
|
|
|
|
|
if (copy) {
|
|
|
|
if (typeof copy.followSymbolicLinks === 'boolean') {
|
|
|
|
result.followSymbolicLinks = copy.followSymbolicLinks
|
|
|
|
core.debug(`followSymbolicLinks '${result.followSymbolicLinks}'`)
|
|
|
|
}
|
|
|
|
|
|
|
|
if (typeof copy.implicitDescendants === 'boolean') {
|
|
|
|
result.implicitDescendants = copy.implicitDescendants
|
|
|
|
core.debug(`implicitDescendants '${result.implicitDescendants}'`)
|
|
|
|
}
|
|
|
|
|
2021-06-01 19:57:03 +00:00
|
|
|
if (typeof copy.matchDirectories === 'boolean') {
|
|
|
|
result.matchDirectories = copy.matchDirectories
|
|
|
|
core.debug(`matchDirectories '${result.matchDirectories}'`)
|
|
|
|
}
|
|
|
|
|
2020-01-09 20:05:31 +00:00
|
|
|
if (typeof copy.omitBrokenSymbolicLinks === 'boolean') {
|
|
|
|
result.omitBrokenSymbolicLinks = copy.omitBrokenSymbolicLinks
|
|
|
|
core.debug(`omitBrokenSymbolicLinks '${result.omitBrokenSymbolicLinks}'`)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return result
|
|
|
|
}
|