mirror of
https://github.com/metabarcoding/obitools4.git
synced 2025-06-29 16:20:46 +00:00
Add managment of the taxonomy alias politic
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
package obilua
|
||||
|
||||
import (
|
||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitax"
|
||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
||||
lua "github.com/yuin/gopher-lua"
|
||||
@ -98,13 +99,18 @@ func taxonomyGetCode(luaState *lua.LState) int {
|
||||
func taxonomyGetTaxon(luaState *lua.LState) int {
|
||||
taxo := checkTaxonomy(luaState)
|
||||
taxid := luaState.CheckString(2)
|
||||
taxon, err := taxo.Taxon(taxid)
|
||||
taxon, isAlias, err := taxo.Taxon(taxid)
|
||||
|
||||
if err != nil {
|
||||
luaState.RaiseError("%s : Error on taxon taxon: %v", taxid, err)
|
||||
return 0
|
||||
}
|
||||
|
||||
if isAlias && obidefault.FailOnTaxonomy() {
|
||||
luaState.RaiseError("%s : Taxon is an alias of %s", taxid, taxon.String())
|
||||
return 0
|
||||
}
|
||||
|
||||
luaState.Push(taxon2Lua(luaState, taxon))
|
||||
return 1
|
||||
}
|
||||
|
Reference in New Issue
Block a user