hoaproject / Console

The Hoa\Console library.
https://hoa-project.net/
366 stars 32 forks source link

Enhancements #22

Closed itskevinsam closed 10 years ago

itskevinsam commented 10 years ago

Hoa\Console\Cursor::move('← ← ← ↑ ↑'); Hoa\Console\Cursor::move('↓'); // move below Hoa\Console\Cursor::clear('↔'); // clear the line

Can you guys please change (←,↑,↔) to use words than using symbols. There is no way i can find those keys in my keyboard. I dont use a Mac.

Edit: My mistake, didnt check "For example, we can use l, left or ← to move the cursor on the left column. Thus we move the cursor to the left 3 times and then to the top 2 times:"

Hywan commented 10 years ago

Hello :-),

Maybe the explanations are not correctly highlighted? What do you think?

CedCannes commented 10 years ago

↑ ↑ ↓ ↓ ← → ← → B A ?

Hywan commented 10 years ago

@CedCannes What?

CedCannes commented 10 years ago

Nothing, sorry , just all these arrows have reminded me konami code :)

Hywan commented 10 years ago

Haha, nice idea for an easter egg :trollface:!

itskevinsam commented 10 years ago

Hoa\Console\Cursor::move('← ← ← ↑ ↑'); Hoa\Console\Cursor::move('↓'); // move below Hoa\Console\Cursor::clear('↔'); // clear the line

it would be better if you could change the examples to use [l/left] instead of the symbols (it scared me first)

Its not like i don't like the syntax, but is there any possibility for having a syntax like Hoa\Console\Cursor::move->left(1)->up(2)->down(1) //This would make more sense (at-least for me:-) )

Hywan commented 10 years ago

@itskevinsam What about a mix or two examples (the same one but with litteral symbols instead of unicode ones)?

itskevinsam commented 10 years ago

"(the same one but with litteral symbols instead of unicode ones)?" <-- that would be great..

Hywan commented 10 years ago

Let's have some other feedbacks. ping @hoaproject/hoackers

jubianchi commented 10 years ago

@Hywan :+1: for examples without unicode chars as it will be less scary for newcomers and also avoid such debates ;)

I also like @itskevinsam proposal : Hoa\Console\Cursor::move->left(1)->up(2)->down(1) :+1:

CircleCode commented 10 years ago

from my point of view, unicode is fun, but not easy to use for everybody, so I think we should support these 3 notations:

edit: I know notations 1 and 3 are already supported, my point is 1. should be the preferred one and then we should show it as reference in examples

1e1 commented 10 years ago

@itskevinsam You can already use ASCII/litteral symbols. Take a look at: https://github.com/hoaproject/Console/blob/master/Cursor.php#L62-79 https://github.com/hoaproject/Console/blob/master/Cursor.php#L266-280

And I'm agree with @CircleCode: Unicode is fun!

Hywan commented 10 years ago

We probably not create methods like left, up etc., it is too much complicated for nothing :-/ (it needs to create a dumb object just to get the ability to have a fluid interface…). Strings like left, right and shorcuts are already supported. @itskevinsam didn't read the documentation well. My question is the following: is the documentation hard to read, or, whether @itskevinsam has read the documentation too fast? I quote the README:

For example, we can use l, left or to move the cursor on the left column. Thus we move the cursor to the left 3 times and then to the top 2 times:

Hoa\Console\Cursor::move('← ← ← ↑ ↑');

Thoughts?

itskevinsam commented 10 years ago

"You can already use ASCII/litteral symbols" <-- agree with that. Checked the examples and saw Hoa\Console\Cursor::move('← ← ← ↑ ↑'); // it would be better to replace that with another example which makes use of literal symbols.

and regarding the syntax "Hoa\Console\Cursor::move('← ← ← ↑ ↑');" <-- i wont say that its bad but "Hoa\Console\Cursor::move->left(10)->up(5)->down(15)" would make things easier to understand.

PS: "Hoa\Console\Cursor::move('l l l l l l l l l l u u u u u d d d d d...')" <-- that might make things complicated. For small use cases the syntax is good.

"documentation hard to read" <-- well no, documentation is not hard to read. But i do believe that people look for examples first (me at-least)

1e1 commented 10 years ago

In this case, perhaps moveTo() is better? getPosition() should be helpful. Or keep move( str_repeat('l ', 10) . str_repeat('u ', 5) . str_repeat('d ', 15) )... Thoughts?

Hywan commented 10 years ago
Cursor::move('left', 10);

works perfectly also.

I will update the README to add the same example but with literals instead of symbols.

Hywan commented 10 years ago

Better https://github.com/hoaproject/Console#cursor ?

itskevinsam commented 10 years ago

"I will update the README to add the same example but with literals instead of symbols" <-- that would be great

itskevinsam commented 10 years ago

and any alternatives for "clear('↔')"

line

Hywan commented 10 years ago

@itskevinsam RTFM :-p. This is a README, not an exhaustive documentation. At this point, users understand that there is an alternative syntax. Please, see http://hoa-project.net/Literature/Hack/Console.html#Cursor, thanks :-).