terms_dynamic.go 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. // +build !tcell_minimal,!nacl,!js,!zos,!plan9,!windows,!android
  2. // Copyright 2019 The TCell Authors
  3. //
  4. // Licensed under the Apache License, Version 2.0 (the "License");
  5. // you may not use file except in compliance with the License.
  6. // You may obtain a copy of the license at
  7. //
  8. // http://www.apache.org/licenses/LICENSE-2.0
  9. //
  10. // Unless required by applicable law or agreed to in writing, software
  11. // distributed under the License is distributed on an "AS IS" BASIS,
  12. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. // See the License for the specific language governing permissions and
  14. // limitations under the License.
  15. package tcell
  16. import (
  17. // This imports a dynamic version of the terminal database, which
  18. // is built using infocmp. This relies on a working installation
  19. // of infocmp (typically supplied with ncurses). We only do this
  20. // for systems likely to have that -- i.e. UNIX based hosts. We
  21. // also don't support Android here, because you really don't want
  22. // to run external programs there. Generally the android terminals
  23. // will be automatically included anyway.
  24. "github.com/gdamore/tcell/terminfo"
  25. "github.com/gdamore/tcell/terminfo/dynamic"
  26. )
  27. func loadDynamicTerminfo(term string) (*terminfo.Terminfo, error) {
  28. ti, _, e := dynamic.LoadTerminfo(term)
  29. if e != nil {
  30. return nil, e
  31. }
  32. return ti, nil
  33. }