[ https://issues.apache.org/jira/browse/CASSANDRA-18914?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Brad Schoening updated CASSANDRA-18914: --------------------------------------- Description: CQSH's core Read-Eval-Print-Loop (REPL) class *Shell* implements the Python stdlib *Cmd* framework for writing line-oriented command interpreters. It is the core of CQLSH. While a subclass of _Lib/cmd.py,_ its currently commingled with command line parsing into a jumbo _cqlshmain.py_ file. It's role as a class is easily missed as there is only one line defining it and one line invoking it. This Jira will separate the definition class Shell (inherited from cmd.Cmd) into its own class file, shell.py. Benefits: * size - excessively large files can be ugly, and cqlshmain is almost 2400 lines. * separation of concerns - argument parsing and interactive interpreters are very different responsibilities. Code is improved and more reusable when unrelated behavior is in separate source file. * clarity - reading cqlshmain, its currently not obvious that 75% of the code is implementing interfaces in the cmd.Cmd library class. There is currently no class comment explaining how the Shell class is implemented. New state: * cqlshmain.py – existing startup and argparse code * shell.py – existing Shell REPL for CQL was: CQSH's core Read-Eval-Print-Loop (REPL) class *Shell* implements the Python stdlib *Cmd* framework for writing line-oriented command interpreters. It is the core of CQLSH. While a subclass of _Lib/cmd.py,_ its currently commingled with command line parsing into a jumbo _cqlshmain.py_ file. It's role as a class is easily missed as there is only one line defining it and one line invoking it. This Jira will separate the definition class Shell (inherited from cmd.Cmd) into its own class file. Benefits: * size - excessively large files can be ugly, and cqlshmain is almost 2400 lines. * separation of concerns - argument parsing and interactive interpreters are very different responsibilities. Code is improved and more reusable when unrelated behavior is in separate source file. * clarity - reading cqlshmain, its currently not obvious that 75% of the code is implementing interfaces in the cmd.Cmd library class. There is currently no class comment explaining how the Shell class is implemented. > Refactor and separate CQLSH 'Shell' repl class > ---------------------------------------------- > > Key: CASSANDRA-18914 > URL: https://issues.apache.org/jira/browse/CASSANDRA-18914 > Project: Cassandra > Issue Type: Improvement > Components: CQL/Interpreter > Reporter: Brad Schoening > Priority: Normal > > CQSH's core Read-Eval-Print-Loop (REPL) class *Shell* implements the Python > stdlib *Cmd* framework for writing line-oriented command interpreters. It is > the core of CQLSH. While a subclass of _Lib/cmd.py,_ its currently > commingled with command line parsing into a jumbo _cqlshmain.py_ file. It's > role as a class is easily missed as there is only one line defining it and > one line invoking it. > This Jira will separate the definition class Shell (inherited from cmd.Cmd) > into its own class file, shell.py. > Benefits: > * size - excessively large files can be ugly, and cqlshmain is almost 2400 > lines. > * separation of concerns - argument parsing and interactive interpreters are > very different responsibilities. Code is improved and more reusable when > unrelated behavior is in separate source file. > * clarity - reading cqlshmain, its currently not obvious that 75% of the > code is implementing interfaces in the cmd.Cmd library class. There is > currently no class comment explaining how the Shell class is implemented. > New state: > * cqlshmain.py – existing startup and argparse code > * shell.py – existing Shell REPL for CQL -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org