(contents: string)
| 18 | } |
| 19 | |
| 20 | export function parseCommitCloudRc(contents: string): { |
| 21 | rawWorkspaceName: string |
| 22 | locallyOwned: boolean | null |
| 23 | } | null { |
| 24 | const rawWorkspaceName = contents |
| 25 | .split(/\r?\n/u) |
| 26 | .map(line => line.trim()) |
| 27 | .find(line => line.startsWith('current_workspace=')) |
| 28 | ?.slice('current_workspace='.length) |
| 29 | .trim() |
| 30 | |
| 31 | if (!rawWorkspaceName) { |
| 32 | return null |
| 33 | } |
| 34 | |
| 35 | const locallyOwnedValue = contents |
| 36 | .split(/\r?\n/u) |
| 37 | .map(line => line.trim()) |
| 38 | .find(line => line.startsWith('locally_owned=')) |
| 39 | ?.slice('locally_owned='.length) |
| 40 | .trim() |
| 41 | .toLowerCase() |
| 42 | |
| 43 | return { |
| 44 | rawWorkspaceName, |
| 45 | locallyOwned: |
| 46 | locallyOwnedValue === 'true' |
| 47 | ? true |
| 48 | : locallyOwnedValue === 'false' |
| 49 | ? false |
| 50 | : null, |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | export function parseSaplingRepoName(contents: string): string | null { |
| 55 | const lines = contents.split(/\r?\n/u).map(line => line.trim()) |
no outgoing calls
no test coverage detected