OSGeo / grass

GRASS GIS - free and open-source geospatial processing engine
https://grass.osgeo.org
Other
852 stars 309 forks source link

[Bug] Move the shell-related functions from init/grass.py to grass.cli.shell #970

Open wenzeslaus opened 4 years ago

wenzeslaus commented 4 years ago

Problem

The file lib/init/grass.py is larger and lager. We need to reduce the amount of code which lives there.

Desired solution

I think a new package and module in the library are the best. A good name and place seems to be grass.cli.shell (cli is a new package, shell is one of its modules ("all different CLI related things including support interactive shells"). Alternatives: grass.cli.shells ("plural since there is more than one shell") and grass.shell or grass.shells ("keep shell-related functions and the (potential) package dedicated to GRASS GIS own command line interface/parsing separate").

Additional context

There was a lot of changes lately and addition of Z shell. This will just keep happening.

There is actually so many items including this one already lined up that I created a GitHub project to track it: Project 2: Shells. (Volunteers welcome! BTW)

Additionally, having the code separately in the library may open some possibilities of reusing it in some terminal-related tasks from GUI (see the discussion about optional and/or additional terminal window on grass-dev). Only theoretical option here, but good idea in general.

cwhite911 commented 4 years ago

@wenzeslaus After looking at the remaining issues in Project 2: Shells I think it makes sense to refactor the cli shell functions into the new package first and then complete the remaining issues. So ordering the remaining cards in the project something like this...

  1. Move the shell-related functions from init/grass.py to grass.cli.shell #970
  2. [Feat] Change the history file according to the current mapset for tcsh #964
  3. [Feat] Change the history file according to the current mapset for tcsh #964
  4. [Bug] GUI should use its own history and not Bash's #962
  5. [Bug] Remove the HOME dir hack from shell setups #965
  6. [Feat] Colorized prompt #942

I'll start working on the refactoring for Move the shell-related functions from init/grass.py to grass.cli.shell #970, but let's settle on a package and module name first.

I like grass.cli.shells or grass.cli.shell

wenzeslaus commented 4 years ago

Sounds good. I reordered the issues in the project. The GUI issue is independent in terms of code (no code for that is in grass.py).

Let's try grass.cli.shells. Sounds most flexible at this point.

For comparison, not necessarily as a thing to follow, see also an older suggestion: grass-dev move everything from /lib/init/grass.py to /lib/python/init (we want to move everything eventually, but taking smaller and different steps).

susi commented 2 years ago

What's the status of this bug? @cwhite911 need help with anything? I'm asking since I'm poking around in grass.py, would like to help out with this :)