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

CLI list output gets shorter if captured in a shell (bash) variable or file #454

Closed
RaitaroH opened this issue Sep 4, 2019 · 5 comments
Closed

Comments

@RaitaroH
Copy link

RaitaroH commented Sep 4, 2019

RaitaroH/adl#9
Basically the output of trackma list is as wide as the terminal is. But once that output is captured to a variable or redirected to a file the output becomes way shorter and in turn cuts long anime names.

Results into a table as wide as your terminal.

trackma list

Doesn't look the same and it gets cut:

  • variable:
tlist=$(trackma list) #or tlist=`trackma list`
echo "$tlist"
  • file:
trackma list > list.txt 
cat list.txt

or

trackma list 1> list.txt
cat list.txt

Entry nr 8 gets cut and becomes unusable in a script:
Screenshot_20190904_110132

@Baitinq
Copy link

Baitinq commented Sep 4, 2019

+1

@Birdulon
Copy link
Contributor

Birdulon commented Sep 4, 2019

The related code is here https://github.com/z411/trackma/blob/master/trackma/utils.py#L277-L296
The following command should be a logical way to go, however it requires int() calls to be inserted on line 292 to prevent strings from propagating and throwing errors elsewhere.
LINES=25 COLUMNS=130 trackma list > test.txt

Birdulon added a commit to Birdulon/trackma that referenced this issue Sep 4, 2019
@Baitinq
Copy link

Baitinq commented Sep 4, 2019

@Birdulon Hey, thanks for the help. I am getting this error when I apply your patch and execute LINES=25 COLUMNS=130 trackma list

Error:
Traceback (most recent call last): File "/usr/bin/trackma", line 11, in <module> load_entry_point('Trackma==0.8.2', 'console_scripts', 'trackma')() File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 489, in load_entry_point return get_distribution(dist).load_entry_point(group, name) File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2852, in load_entry_point return ep.load() File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2443, in load return self.resolve() File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2449, in resolve module = __import__(self.module_name, fromlist=['__name__'], level=0) File "/usr/lib/python3.7/site-packages/trackma/ui/cli.py", line 34, in <module> from trackma.engine import Engine File "/usr/lib/python3.7/site-packages/trackma/engine.py", line 28, in <module> from trackma import data File "/usr/lib/python3.7/site-packages/trackma/data.py", line 22, in <module> from trackma import utils File "/usr/lib/python3.7/site-packages/trackma/utils.py", line 295 except: ^ SyntaxError: invalid syntax

@RaitaroH
Copy link
Author

RaitaroH commented Sep 4, 2019

I applied the PR everything works. Thanks.

@Baitinq
Copy link

Baitinq commented Sep 4, 2019

@Birdulon Nvm, I was able to fix it. Thanks a lot for the patch. I hope this gets merged soon.

z411 added a commit that referenced this issue Sep 5, 2019
[CLI] Environment variable fix for #454
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

No branches or pull requests

3 participants