Skip to content

Commit

Permalink
Make a configurable refNameColumn (#2760)
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin authored Feb 23, 2022
1 parent 225c797 commit beaac0e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ export default class RefNameAliasAdapter
return []
}
const results = await openLocation(loc).readFile('utf8')
const refColumn = readConfObject(this.config, 'refNameColumn')
return results
.trim()
.split('\n')
.filter(f => !!f && !f.startsWith('#'))
.map(row => {
const [refName, ...aliases] = row.split('\t')
const aliases = row.split('\t')
const [refName] = aliases.splice(refColumn, 1)
return { refName, aliases }
})
}
Expand Down
4 changes: 4 additions & 0 deletions plugins/config/src/RefNameAliasAdapter/configSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ export default ConfigurationSchema(
locationType: 'UriLocation',
},
},
refNameColumn: {
type: 'number',
defaultValue: 0,
},
},
{ explicitlyTyped: true },
)

0 comments on commit beaac0e

Please sign in to comment.