use if clause to support gui and terminal at once