Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨Terminal file output #220

Merged
merged 10 commits into from
Aug 22, 2022
Merged

✨Terminal file output #220

merged 10 commits into from
Aug 22, 2022

Conversation

sharmaneha03
Copy link
Contributor

Summary:

Added terminal option that sends output to a file by redirecting the standard output stream. Output is displayed in both the terminal and file.

References (optional):

Closes #108 (Add File Redirect Option to Terminal)

Test Plan:

Using the command pros terminal --output [filename] should show output in the terminal and the selected file. Afterwards, it should return to the original state of the standard output stream (terminal only).

@sharmaneha03 sharmaneha03 changed the title Feature/terminal file output ✨Feature/terminal file output Jul 3, 2022
@sharmaneha03 sharmaneha03 changed the title ✨Feature/terminal file output ✨Terminal file output Jul 3, 2022
pros/cli/terminal.py Outdated Show resolved Hide resolved
pros/cli/terminal.py Outdated Show resolved Hide resolved
Co-authored-by: BennyBot <[email protected]>
Copy link
Member

@WillXuCodes WillXuCodes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For what this is, it works as intended, everything from stdout goes into a file. However, one design consideration we should consider for the future is to prevent the header and any warnings from going into the terminal if requested. However, this is easier said than done and also it might be advantageous to keep this in here anyways as more of a log than a data collection system (that's what the SD card is for anyways tbh).

Output after running pros terminal --output and running a default PROS Project:

WARNING - pros.serial.terminal.terminal:stop - Stopping terminal
WARNING - pros.serial.terminal.terminal:stop - Stopping terminal



         �[1;33m_+=+_�[0m
     �[1;33m .-`  .  `-. �[0m         8888888b.  8888888b.   .d88888b.   .d8888b.
  �[1;33m _+`     "     `+_ �[0m      888   Y88b 888   Y88b d88P" "Y88b d88P  Y88b
  �[1;33m\\\sssssssssssss///�[0m      888    888 888    888 888     888 Y88b.
     �[1;33m.ss\  �[37m*�[33m  /ss.�[0m         888   d88P 888   d88P 888     888  "Y888b.
 �[1;33m.+bm�[0m  �[1;33m.s�[37m  *  �[33ms.�[0m  �[1;33mmd+.�[0m     8888888P"  8888888P"  888     888     "Y88b.
�[1;33m.hMMMMs�[0m �[1;33m.�[37m  *  �[33m.�[0m �[1;33msMMMMh.�[0m    888        888 T88b   888     888       "888
 �[1;33m`\hMMMb�[0m �[1;33m\�[37m | �[33m/�[0m �[1;33mdMMMh:�[0m      888        888  T88b  Y88b. .d88P Y88b  d88P
   �[1;33m-SNMNo�[0m  �[1;33m-�[0m  �[1;33moNMNs-�[0m       888        888   T88b  "Y88888P"   "Y8888P"
     �[1;33m`+dMh\./dMd/�[0m
        �[1;33m`:yNy:`�[0m                      �[1;33mPowered by PROS for VEX V5�[0m
           �[1;33m"�[0m                Copyright (c) Purdue University ACM SIGBots
Version:�[1m3.6.3-commit.7.fa8dcc7�[0m     Platform:  �[1mV1.1.0 (b8)�[0m     Uptime:�[1m    0.000 s�[0m
Compiled:   �[1m             Unknown�[0m     Directory:  �[1m               Unknown�[0m


WARNING - pros.serial.terminal.terminal:stop - Stopping terminal

Copy link
Member

@kunwarsahni01 kunwarsahni01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After re-configuring on my end looks like it all works on macos m1.

@WillXuCodes WillXuCodes merged commit ac6135d into develop Aug 22, 2022
@kunwarsahni01 kunwarsahni01 mentioned this pull request Aug 24, 2022
kunwarsahni01 added a commit that referenced this pull request Aug 25, 2022
* 🐛 emit correct compiler for C files when generating CDB (#188)

* Update Azure Pipelines with new self hosted M1 Mac (#189)

* Update azure-pipelines.yml for Azure Pipelines

* Update azure-pipelines.yml

* Update azure-pipelines.yml for Azure Pipelines

* Update azure-pipelines.yml for Azure Pipelines

* Fixes 'make.exe.exe' typo. Adds disable sentry prompt option for VSCode. (#190)

* Fixes 'make.exe.exe' typo. Adds disable sentry prompt option for VSCode.

* Fix sentry-off flag

* change sentry-off to no-sentry

* Update Version (#186) (#191)

* ✨Add Analytics (#193)

* Fix and move no-sentry to default options. Setup framework for analytics

* Fix some things. --toggle-analytics works

* Analytics should be working. Need to figure out which commands matter

* Make use-analytics a choice not a toggle

* Show no-analytics flag feedback so user knows it works

* Analytics appear to be working!

* Reset uid to None

* Compress code a bit

* Remove interactive command analytics. Fix info-project typo

* Move GA config to cli.pros. Fixes --use-analytics

* ✨More Upload Options (#194)

* Start of more upload options

* Adds project icon, name, and description. Use name/description="string"

* pros v5 rm-program command

* rm program literals

* Remove extra print messages. Kernel version = None when no project

* Update Version (#186) (#195)

* Add __init__ file so ga is considered a module (#206)

* Fix issue with programs uploading segfaulting/NACKing/doing nothing (#207)

* ✨Set team number and robot name (#210)

* Adds kv_read and kv_write functions (UNTESTED) to V5Device class

* Add commands to read and set kernel variables

* Add descriptions to set_variable and read_variable commands

* Finish reading kernel variables. Use None for unknown rx length

* Trim kernel variable value and ensure null terminated.

* Move rv and sv to v5 commands

* Working set command. Maximum lengths based on brain's screen space

* get and set aliases

* Add m as an alias for pros make. (#204)

* Cleaned Up CI (#213)

* Update azure-pipelines.yml for Azure Pipelines

* Update azure-pipelines.yml for Azure Pipelines

* Update azure-pipelines.yml for Azure Pipelines

* Update azure-pipelines.yml for Azure Pipelines

* Update azure-pipelines.yml for Azure Pipelines

* Update azure-pipelines.yml for Azure Pipelines

* Update azure-pipelines.yml for Azure Pipelines

* Update azure-pipelines.yml for Azure Pipelines

* Update azure-pipelines.yml for Azure Pipelines

* Update azure-pipelines.yml for Azure Pipelines

* Update azure-pipelines.yml for Azure Pipelines

* Update azure-pipelines.yml for Azure Pipelines

* Revert "✨Set team number and robot name (#210)" (#214)

This reverts commit 62ee4b8.

* ✨Set team number and robot name (#219)

* old code (not working)

* use correct txrx function

* return set value

* ✨Terminal file output (#220)

* Added file redirect click.option to terminal.py

* Got rid of indentation error

* Added code for output

* Redirects standard output stream to file

* Outputs to both terminal and file

* Modified imported modules

* Added line at end

* changes on windows

* Update pros/cli/terminal.py for terminal file output

Co-authored-by: Will Xu <[email protected]>

* Removed ident error

Co-authored-by: BennyBot <[email protected]>

Co-authored-by: Will Xu <[email protected]>
Co-authored-by: Benjamin Davis <[email protected]>
Co-authored-by: Will Xu <[email protected]>
Co-authored-by: BennyBot <[email protected]>

Co-authored-by: Alex Brooke <[email protected]>
Co-authored-by: BennyBot <[email protected]>
Co-authored-by: Benjamin Davis <[email protected]>
Co-authored-by: sharmaneha03 <[email protected]>
Co-authored-by: Will Xu <[email protected]>
Co-authored-by: Will Xu <[email protected]>
ayushuk pushed a commit that referenced this pull request Oct 19, 2022
* Added file redirect click.option to terminal.py

* Got rid of indentation error

* Added code for output

* Redirects standard output stream to file

* Outputs to both terminal and file

* Modified imported modules

* Added line at end

* changes on windows

* Update pros/cli/terminal.py for terminal file output

Co-authored-by: Will Xu <[email protected]>

* Removed ident error

Co-authored-by: BennyBot <[email protected]>

Co-authored-by: Will Xu <[email protected]>
Co-authored-by: Benjamin Davis <[email protected]>
Co-authored-by: Will Xu <[email protected]>
Co-authored-by: BennyBot <[email protected]>
kunwarsahni01 added a commit that referenced this pull request Nov 14, 2022
* 🐛 emit correct compiler for C files when generating CDB (#188)

* Update Azure Pipelines with new self hosted M1 Mac (#189)

* Update azure-pipelines.yml for Azure Pipelines

* Update azure-pipelines.yml

* Update azure-pipelines.yml for Azure Pipelines

* Update azure-pipelines.yml for Azure Pipelines

* Fixes 'make.exe.exe' typo. Adds disable sentry prompt option for VSCode. (#190)

* Fixes 'make.exe.exe' typo. Adds disable sentry prompt option for VSCode.

* Fix sentry-off flag

* change sentry-off to no-sentry

* Update Version (#186) (#191)

* ✨Add Analytics (#193)

* Fix and move no-sentry to default options. Setup framework for analytics

* Fix some things. --toggle-analytics works

* Analytics should be working. Need to figure out which commands matter

* Make use-analytics a choice not a toggle

* Show no-analytics flag feedback so user knows it works

* Analytics appear to be working!

* Reset uid to None

* Compress code a bit

* Remove interactive command analytics. Fix info-project typo

* Move GA config to cli.pros. Fixes --use-analytics

* ✨More Upload Options (#194)

* Start of more upload options

* Adds project icon, name, and description. Use name/description="string"

* pros v5 rm-program command

* rm program literals

* Remove extra print messages. Kernel version = None when no project

* Update Version (#186) (#195)

* Add __init__ file so ga is considered a module (#206)

* Fix issue with programs uploading segfaulting/NACKing/doing nothing (#207)

* ✨Set team number and robot name (#210)

* Adds kv_read and kv_write functions (UNTESTED) to V5Device class

* Add commands to read and set kernel variables

* Add descriptions to set_variable and read_variable commands

* Finish reading kernel variables. Use None for unknown rx length

* Trim kernel variable value and ensure null terminated.

* Move rv and sv to v5 commands

* Working set command. Maximum lengths based on brain's screen space

* get and set aliases

* Add m as an alias for pros make. (#204)

* Cleaned Up CI (#213)

* Update azure-pipelines.yml for Azure Pipelines

* Update azure-pipelines.yml for Azure Pipelines

* Update azure-pipelines.yml for Azure Pipelines

* Update azure-pipelines.yml for Azure Pipelines

* Update azure-pipelines.yml for Azure Pipelines

* Update azure-pipelines.yml for Azure Pipelines

* Update azure-pipelines.yml for Azure Pipelines

* Update azure-pipelines.yml for Azure Pipelines

* Update azure-pipelines.yml for Azure Pipelines

* Update azure-pipelines.yml for Azure Pipelines

* Update azure-pipelines.yml for Azure Pipelines

* Update azure-pipelines.yml for Azure Pipelines

* Revert "✨Set team number and robot name (#210)" (#214)

This reverts commit 62ee4b8.

* ✨Set team number and robot name (#219)

* old code (not working)

* use correct txrx function

* return set value

* ✨Terminal file output (#220)

* Added file redirect click.option to terminal.py

* Got rid of indentation error

* Added code for output

* Redirects standard output stream to file

* Outputs to both terminal and file

* Modified imported modules

* Added line at end

* changes on windows

* Update pros/cli/terminal.py for terminal file output

Co-authored-by: Will Xu <[email protected]>

* Removed ident error

Co-authored-by: BennyBot <[email protected]>

Co-authored-by: Will Xu <[email protected]>
Co-authored-by: Benjamin Davis <[email protected]>
Co-authored-by: Will Xu <[email protected]>
Co-authored-by: BennyBot <[email protected]>

* Fix typo in comment

* add FEATURE_REQUEST.md (#230)

* ✨Move Issue Template Files (#231)

* Move Issue Template Files

* Update BUG_REPORT.md

* Create main.yml

* Update main.yml

* Add pyinstaller requirement

* Add .spec file

* Update main.yml

* add universal2 arch

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* attempt fake version number

* Update main.yml

* Update main.yml

* Update main.yml

* version.py exception

* Update main.yml

* Try adding --always and stderr

* remove --always

* fetch tags to prevent name error?

* Add Fetch Depth

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update requirements.txt

* Remove older ci/cd files

* Move to new build constants system

* Basic Import structure for pyinstaller

* Move back to spec file

* Install wheel first

* Correct constant writing

* Remove old Build Constants

* Add wheel building

* Different Name for Wheel Artifact

* Typo

* Codeql Analysis

* Only on dev/master for code scan

* 🔖 Release 3.3.3 (#215)

* 🐛 emit correct compiler for C files when generating CDB (#188)

* Update Azure Pipelines with new self hosted M1 Mac (#189)

* Update azure-pipelines.yml for Azure Pipelines

* Update azure-pipelines.yml

* Update azure-pipelines.yml for Azure Pipelines

* Update azure-pipelines.yml for Azure Pipelines

* Fixes 'make.exe.exe' typo. Adds disable sentry prompt option for VSCode. (#190)

* Fixes 'make.exe.exe' typo. Adds disable sentry prompt option for VSCode.

* Fix sentry-off flag

* change sentry-off to no-sentry

* Update Version (#186) (#191)

* ✨Add Analytics (#193)

* Fix and move no-sentry to default options. Setup framework for analytics

* Fix some things. --toggle-analytics works

* Analytics should be working. Need to figure out which commands matter

* Make use-analytics a choice not a toggle

* Show no-analytics flag feedback so user knows it works

* Analytics appear to be working!

* Reset uid to None

* Compress code a bit

* Remove interactive command analytics. Fix info-project typo

* Move GA config to cli.pros. Fixes --use-analytics

* ✨More Upload Options (#194)

* Start of more upload options

* Adds project icon, name, and description. Use name/description="string"

* pros v5 rm-program command

* rm program literals

* Remove extra print messages. Kernel version = None when no project

* Update Version (#186) (#195)

* Add __init__ file so ga is considered a module (#206)

* Fix issue with programs uploading segfaulting/NACKing/doing nothing (#207)

* ✨Set team number and robot name (#210)

* Adds kv_read and kv_write functions (UNTESTED) to V5Device class

* Add commands to read and set kernel variables

* Add descriptions to set_variable and read_variable commands

* Finish reading kernel variables. Use None for unknown rx length

* Trim kernel variable value and ensure null terminated.

* Move rv and sv to v5 commands

* Working set command. Maximum lengths based on brain's screen space

* get and set aliases

* Add m as an alias for pros make. (#204)

* Cleaned Up CI (#213)

* Update azure-pipelines.yml for Azure Pipelines

* Update azure-pipelines.yml for Azure Pipelines

* Update azure-pipelines.yml for Azure Pipelines

* Update azure-pipelines.yml for Azure Pipelines

* Update azure-pipelines.yml for Azure Pipelines

* Update azure-pipelines.yml for Azure Pipelines

* Update azure-pipelines.yml for Azure Pipelines

* Update azure-pipelines.yml for Azure Pipelines

* Update azure-pipelines.yml for Azure Pipelines

* Update azure-pipelines.yml for Azure Pipelines

* Update azure-pipelines.yml for Azure Pipelines

* Update azure-pipelines.yml for Azure Pipelines

* Revert "✨Set team number and robot name (#210)" (#214)

This reverts commit 62ee4b8.

* Update Version to 3.3.3

* Update Version to 3.3.3

* Revert kernel variable read/set

Co-authored-by: Kunwar Sahni <[email protected]>
Co-authored-by: Alex Brooke <[email protected]>

* ✨Set team number and robot name (#219)

* old code (not working)

* use correct txrx function

* return set value

* ✨Terminal file output (#220)

* Added file redirect click.option to terminal.py

* Got rid of indentation error

* Added code for output

* Redirects standard output stream to file

* Outputs to both terminal and file

* Modified imported modules

* Added line at end

* changes on windows

* Update pros/cli/terminal.py for terminal file output

Co-authored-by: Will Xu <[email protected]>

* Removed ident error

Co-authored-by: BennyBot <[email protected]>

Co-authored-by: Will Xu <[email protected]>
Co-authored-by: Benjamin Davis <[email protected]>
Co-authored-by: Will Xu <[email protected]>
Co-authored-by: BennyBot <[email protected]>

* Fix typo in comment

* add FEATURE_REQUEST.md (#230)

* ✨Move Issue Template Files (#231)

* Move Issue Template Files

* Update BUG_REPORT.md

* ✨ Version Display On Error

* Update main.yml

* Update main.yml

* Revert "Merge branch 'develop' of github.com:purduesigbots/pros-cli into develop"

This reverts commit a3de138, reversing
changes made to d953b0d.

* Revert "Revert "Merge branch 'develop' of github.com:purduesigbots/pros-cli into develop""

This reverts commit 0929e41.

* ✨ Run make clean after uninstall template (#244)

* Run make clean after uninstall temp

* Add flag

* Update version to 3.4.1

Co-authored-by: Kunwar Sahni <[email protected]>
Co-authored-by: Alex Brooke <[email protected]>
Co-authored-by: BennyBot <[email protected]>
Co-authored-by: Benjamin Davis <[email protected]>
Co-authored-by: sharmaneha03 <[email protected]>
Co-authored-by: Will Xu <[email protected]>
Co-authored-by: Will Xu <[email protected]>
Co-authored-by: niu <[email protected]>
Co-authored-by: Liam Teale <[email protected]>
Co-authored-by: AlexHunton2 <[email protected]>
Co-authored-by: omegaStag <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add File Redirect Option to Terminal
4 participants