rgs1/zk_shell

issue with tree command output

Opened this issue · 10 comments

  1. The tree command shows the tree from right to left instead of left to right
  2. Using non-interactive mode e.g.
    export ZKSHELL_SRC=1; bin/zk-shell --run-once "tree /" localhost:2181 | less
    I get "'ascii' codec can't encode characters in position 0-2: ordinal not in range(128)" (followed by 'usage' help for the tree command)
    If in the non-interactive invocation above I dont pipe the output (ie. no |less), just let it go to stdout then the tree output does appear (no such ascii codec error).
rgs1 commented

Thanks for reporting @GL101 ! For the first thing, I am not sure what you mean. The tree does get display from left to right:

~ ✔ zk-shell 0
Welcome to zk-shell (1.0.06)
(CONNECTING) /> 
(CONNECTED) /> tree
.
├── zookeeper
│   ├── config
│   ├── quota
│   │   ├── limits
│   │   │   ├── by-path
│   │   │   ├── slices
│   │   │   ├── global
│   │   ├── stats
│   │   │   ├── by-path
│   │   │   ├── global
(CONNECTED) /> 

Could you please provide an example of what you mean? For the 2nd issue, you are right, we should encode to utf-8 if we want this to work when outputting to a pipe (i.e.: using | less), as per:

http://stackoverflow.com/questions/492483/setting-the-correct-encoding-when-piping-stdout-in-python

I'll submit a fix for that shortly. Thanks!

Hi Raul, Thanks for the quick reply.
And thanks for zkshell, I just started playing with it today and its been
very useful already.

On my machine (I use putty to connect to an Ubunto VM) when I use 'tree'
everything is right aligned.
Below is a paste from the putty. The three weird characters you see are
actually displayed to the right of "delete_topics" and seem to appear
instead of the '|' you show in your output.


(CONNECTED) /> tree /admin
.
גגג delete_topics

(CONNECTED) />

There is no special configuration to my putty and I havent seen something
like this occur before.

btw, I plan to submit a feature request (that DU or some alternative
command output a count of the number of znodes, not just sum of their
sizes).

Thanks again for your work.

Regards, Guy

On Tue, May 26, 2015 at 8:54 PM, Raúl Gutiérrez Segalés <
notifications@github.com> wrote:

Thanks for reporting @GL101 https://github.com/gl101 ! For the first
thing, I am not sure what you mean. The tree does get display from left to
right:

~ ✔ zk-shell 0
Welcome to zk-shell (1.0.06)
(CONNECTING) />
(CONNECTED) /> tree.
├── zookeeper
│ ├── config
│ ├── quota
│ │ ├── limits
│ │ │ ├── by-path
│ │ │ ├── slices
│ │ │ ├── global
│ │ ├── stats
│ │ │ ├── by-path
│ │ │ ├── global
(CONNECTED) />

Could you please provide an example of what you mean? For the 2nd issue,
you are right, we should encode to utf-8 if we want this to work when
outputting to a pipe (i.e.: using | less), as per:

http://stackoverflow.com/questions/492483/setting-the-correct-encoding-when-piping-stdout-in-python

I'll submit a fix for that shortly. Thanks!


Reply to this email directly or view it on GitHub
#28 (comment).

rgs1 commented

@GL101 : note that there is child_count for counting znodes under a path:

(CONNECTED) /> man child_count

NAME
        child_count - Prints the child count for paths

SYNOPSIS
        child_count [path] [depth]

OPTIONS
        * path: the path (default: cwd)
        * max_depth: max recursion limit (0 is no limit) (default: 1)

EXAMPLES
        > child-count /
        /zookeeper: 2
        /foo: 0
        /bar: 3

thats perfect! thanks.

On Tue, May 26, 2015 at 9:40 PM, Raúl Gutiérrez Segalés <
notifications@github.com> wrote:

@GL101 https://github.com/gl101 : note that there is child_count for
counting znodes under a path:

(CONNECTED) /> man child_count

NAME
child_count - Prints the child count for paths

SYNOPSIS
child_count [path] [depth]

OPTIONS
* path: the path (default: cwd)
* max_depth: max recursion limit (0 is no limit) (default: 1)

EXAMPLES
> child-count /
/zookeeper: 2
/foo: 0
/bar: 3

Reply to this email directly or view it on GitHub
#28 (comment).

rgs1 commented

@GL101 : this 89fc307 should fix it, could you please try? Thanks!

Great, its working for me.
Thank you
Regards,
Guy

On Wed, May 27, 2015 at 6:07 AM, Raúl Gutiérrez Segalés <
notifications@github.com> wrote:

@GL101 https://github.com/gl101 : this 8fe145d
8fe145d
should fix it, could you please try? Thanks!

Reply to this email directly or view it on GitHub
#28 (comment).

rgs1 commented

@GL101 : what about right to left output?

Hi Raul, I think this part was still not working for me. I havent had time
to check again to be sure - things are hectic at the moment. I will be in
touch when I check.
Thanks, Guy

On Wed, May 27, 2015 at 7:42 PM, Raúl Gutiérrez Segalés <
notifications@github.com> wrote:

@GL101 https://github.com/gl101 : what about right to left output?

Reply to this email directly or view it on GitHub
#28 (comment).

Hi Raul, I just checked the latest zkshell version and the right to left
output in 'tree' still occurs for me.
Regards, Guy

On Fri, May 29, 2015 at 4:11 PM, Guy Laden guy.laden@gmail.com wrote:

Hi Raul, I think this part was still not working for me. I havent had time
to check again to be sure - things are hectic at the moment. I will be in
touch when I check.
Thanks, Guy

On Wed, May 27, 2015 at 7:42 PM, Raúl Gutiérrez Segalés <
notifications@github.com> wrote:

@GL101 https://github.com/gl101 : what about right to left output?

Reply to this email directly or view it on GitHub
#28 (comment).

Regarding the left to right output:
Turns out this had nothing to do with zkshell
It is a Putty issue. One needs, in Putty, to check the box "Disabling bidirectional text display"