tldr-pages / tldr

๐Ÿ“š Collaborative cheatsheets for console commands
https://tldr.sh
Other
50.44k stars 4.12k forks source link

Adding Android commands #5462

Closed navarroaxel closed 3 years ago

navarroaxel commented 3 years ago

Where should we store the pages dedicated to native Android commands that run only inside an shell session running in an Android device or emulator open via adb shell?

Alternatives:

tansiret commented 3 years ago

Makes sense to me. There are many Android-savvy people out there who would be mad about it.

navarroaxel commented 3 years ago

Makes sense to me. There are many Android-savvy people out there who would be mad about it.

@Yutyo Which option do you like?

bl-ue commented 3 years ago

I'm inclinded towards option 2, because the way most people call these commands is via adb shell <command>โ€”correct?

Also, can any Linux commands like cat, tar, ps, etc. be called from the same shell where these commands can be called like normal commands? Or is the shell special, so that only these commands e.g. logcat can be called within?

tansiret commented 3 years ago

@Yutyo Which option do you like?

create an android folder.

bl-ue commented 3 years ago

The reason I'm not keen on making a pages/android folder is: how many commands will we put in? Only a few, like 10, probably. Also, are these actually available in the Android OS without the debugging (i.e. can any normal user run them from a terminal app, if such a thing exists on Android?). In that case, they're not really Android commands, they're more like Android Studio commands (if that's what's providing them.)

navarroaxel commented 3 years ago

@bl-ue you can install Termux https://play.google.com/store/apps/details?id=com.termux and run android commands using just the phone.

bl-ue commented 3 years ago

Ah okay, I didn't know that (I'm not a Droid guy ๐Ÿ™‚). Can any user run logcat that way, regardless of whether or not they're a developer?

Rudloff commented 3 years ago

Android is a Linux-based OS and it can run most Linux CLI tools. So I would put the Android-specific commands in linux/ (same as we have some Debian-specific commands in there).

Also, are these actually available in the Android OS without the debugging (i.e. can any normal user run them from a terminal app, if such a thing exists on Android?)

You can totally run a terminal on Android. Termux is the most popular app for doing that. (It also comes with apt so you can install additional tools.)

Also, can any Linux commands like cat, tar, ps, etc. be called from the same shell where these commands can be called like normal commands?

The Android is shell is a classic Linux shell. You can also run zsh, fish, etc.

bl-ue commented 3 years ago

Okay, I didn't know this. Thanks for the explanation @Rudloff.

@Rudloff: Can any user run logcat that way, regardless of whether or not they're a developer?

Rudloff commented 3 years ago

Any user can open a terminal app and then call logcat. (Some other Android commands require the user to have root privileges.)

Screenshot_20210316-212856_Termux

Not everyone agrees, but the Linux Foundation considers Android a Linux distribution.

bl-ue commented 3 years ago

Okay, then I strongly vote for option 3. If they're normal commands on Android, then definitely we should treat them as such.

navarroaxel commented 3 years ago

cool @bl-ue, but @Rudloff propone to leave this command under the linux/ platform.

bl-ue commented 3 years ago

Yeah, sorry, I concur. I mean "option 3 but under pages/linux" ๐Ÿ‘๐Ÿป

tansiret commented 3 years ago

Android is a Linux-based OS and it can run most Linux CLI tools. So I would put the Android-specific commands in linux/ (same as we have some Debian-specific commands in there).

Also, are these actually available in the Android OS without the debugging (i.e. can any normal user run them from a terminal app, if such a thing exists on Android?)

You can totally run a terminal on Android. Termux is the most popular app for doing that. (It also comes with apt so you can install additional tools.)

Also, can any Linux commands like cat, tar, ps, etc. be called from the same shell where these commands can be called like normal commands?

The Android is shell is a classic Linux shell. You can also run zsh, fish, etc.

Android doesn't have GNU utils tho. Its also not a Linux OS but only uses Linux as a kernel, and uses a modified one.

sbrl commented 3 years ago

Great discussion here. So we've established that commands like logcat are normal commands that you can run in a shell on an Android device. In this case, we do not want to file then as asb-shell-{{command_name}} as I initially thought.

In terms On the one hand, Android uses a (modified) Linux kernel, suggesting we should put pages in linux, and you cna use a Bash shell as with any other Linux distribution.

On the other hand, Android devices generally have sufficiently different layout of commands that we might want to consider giving Android it's own platform. Supporting this idea is the lack of Gnu coreutils.

Personally, I would perhaps suggest that a new platformandroid might be the better option here. Given my (extremely limited) experience with the layout of commands in an Android terminal shell, I'm seeing Android as different to a "regular" linux machine as macOS is - in that macOS runs Bash, but it has a number of platform-specific differences that mean it needss it's own set of pages for stuff like mv, cp, etc.

Rudloff commented 3 years ago

I don't mind having a new android platform. (It's just that it will not have a lot of pages.)

bl-ue commented 3 years ago

It'll probably have more than sunos does :)

marchersimon commented 3 years ago

Is there even a tldr client for android? Because otherwise you'd have to specify --os android every time. But we also can't put it to linux since the adb shell works under windows and macos as well.

navarroaxel commented 3 years ago

I don't know how it works, but I use the python client in Arch Linux with the default installation options and I can request macOS pages without extra params just:

tldr bless

If a user change it to use a specific platform I think the expect result for Android platform pages (not found) it's correct.

bl-ue commented 3 years ago

Huh, good point. Yes, we have an Android client: https://github.com/Techno-Disaster/tldr-flutter. You can see all of our known clients here.

As for the adb shell problem, I just though of an idea: we could create common/adb-shell-<command>.md as a link to linux/<command>.md.

Thoughts?

Rudloff commented 3 years ago

Technically, it is also possible to run the Node or Python CLI clients in an Android shell.

Rudloff commented 3 years ago

As for the adb shell problem, I just though of an idea: we could create common/adb-shell-.md as a link to linux/.md.

On one hand, most users will run Android commands through adb shell, so I guess it makes sense to document it.

On the other hand, any command can be called through adb shell, so were do we draw the line? Should we create adb-shell-ls.md? (It is a bit like saying that you can call Linux commands through SSH, so we should create ssh-<command>.md.)

Maybe if we have an android platform, adb-shell.md could mention that Android-specific commands are documented in the android folder?

bl-ue commented 3 years ago

Yeah, let's do something like. I didn't realize that adb shell could execute any command. Ignore my above idea, then.

navarroaxel commented 3 years ago

Yeah, let's do something like. I didn't realize that adb shell could execute any command. Ignore my above idea, then.

@bl-ue maybe we should let that clear in the adb-shell page.

So, could we unblock the android command pages and close this ticket?

sbrl commented 3 years ago

I'd suggest we create a new platform for android here. This will in some clients necessitate a minor client update - specifically our Android clients (which will have to update their page resolution algorithms to pull from the android platform first), so we'll probably want to @mention their authors here.

Despite this, it shouldn't break anything if we just start merging PRs that add the new platform. We did the same for windows. The client spec mandates that clients at least do not get upset if new platforms are added - and recommends that support for new platforms is automatic.

Any client issues are issues of correctness as opposed to breakages, so I think it's safe to just start merging PRs today.

bl-ue commented 3 years ago

cc @Techno-Disaster @hidroh

techno-disaster commented 3 years ago

The flutter client should not be affected. I don't check the OS there and show those commands first. Have a small script updating this txt file every 6 hours. New commands get added in a key(command) and value(platform) pair, and I show this in the search page.

bl-ue commented 3 years ago

@Techno-Disaster all Android clients should be updated to check the android folder (if it exists) first, before any others.

techno-disaster commented 3 years ago

@Techno-Disaster all Android clients should be updated to check the android folder (if it exists) first, before any others.

I'll look into this soon.

sbrl commented 3 years ago

This issue was closed as the issue at hand has been resolved: the new android platform has been created.

(@marchersimon, next time perhaps you could leave a comment when closing issues to explain why for the record? It helps keep everyone on the same page :slightly_smiling_face:)