From 4aaa768b27f85e4820759c9036400f321ea9c301 Mon Sep 17 00:00:00 2001 From: SyedAhkam Date: Sat, 7 Oct 2023 14:01:46 +0530 Subject: [PATCH] feat: almost everything documented --- docs/book.toml | 5 ++++ docs/src/SUMMARY.md | 26 ++++++++++++++++- docs/src/commands/build.md | 28 ++++++++++++++++++ docs/src/commands/devices.md | 19 +++++++++++++ docs/src/commands/emulator.md | 3 ++ docs/src/commands/install.md | 28 ++++++++++++++++++ docs/src/commands/launch.md | 19 +++++++++++++ docs/src/commands/run.md | 28 ++++++++++++++++++ docs/src/commands/shell.md | 3 ++ docs/src/faq.md | 13 +++++++++ docs/src/get-started/create-or-link.md | 39 ++++++++++++++++++++++++++ docs/src/get-started/installation.md | 21 ++++++++++++++ docs/src/introduction.md | 6 ++-- docs/src/legal.md | 7 +++++ docs/src/reference/dot-android.md | 3 ++ 15 files changed, 245 insertions(+), 3 deletions(-) create mode 100644 docs/src/commands/build.md create mode 100644 docs/src/commands/devices.md create mode 100644 docs/src/commands/emulator.md create mode 100644 docs/src/commands/install.md create mode 100644 docs/src/commands/launch.md create mode 100644 docs/src/commands/run.md create mode 100644 docs/src/commands/shell.md create mode 100644 docs/src/faq.md create mode 100644 docs/src/get-started/create-or-link.md create mode 100644 docs/src/get-started/installation.md create mode 100644 docs/src/legal.md create mode 100644 docs/src/reference/dot-android.md diff --git a/docs/book.toml b/docs/book.toml index 4b4fd3b..e191151 100644 --- a/docs/book.toml +++ b/docs/book.toml @@ -1,6 +1,11 @@ [book] title="Android CLI" authors = ["Syed Ahkam"] +description = "Documentation for the tool android-cli" + language = "en" multilingual = false src = "src" +git-repository-url = "https://github.com/SyedAhkam/android-cli" +git-repository-icon = "fa-github" +edit-url-template = "https://github.com/SyedAhkam/android-cli/edit/master/docs/{path}" \ No newline at end of file diff --git a/docs/src/SUMMARY.md b/docs/src/SUMMARY.md index e0ff9f9..c135ef9 100644 --- a/docs/src/SUMMARY.md +++ b/docs/src/SUMMARY.md @@ -1,3 +1,27 @@ # Summary -- [Introduction](./introduction.md) +[Introduction](./introduction.md) + +# Get Started + +- [Installation](get-started/installation.md) +- [Create or Link Project](get-started/create-or-link.md) + +# Commands + +- [android build](commands/build.md) +- [android install](commands/install.md) +- [android launch](commands/launch.md) +- [android run](commands/run.md) +- [android devices](commands/devices.md) +- [android shell](commands/shell.md) +- [android emulator](commands/emulator.md) + +# Reference + +- [.android](reference/dot-android.md) + +----------- + +[Frequently Asked Questions](faq.md) +[Legal](legal.md) \ No newline at end of file diff --git a/docs/src/commands/build.md b/docs/src/commands/build.md new file mode 100644 index 0000000..9469792 --- /dev/null +++ b/docs/src/commands/build.md @@ -0,0 +1,28 @@ +# Build Project + +``` +USAGE: + android build [OPTIONS] + +OPTIONS: + -h, --help Print help information + -r, --release Should build in release mode +``` + +## What it does + +For now, it just execs `./gradlew assemble[Debug|Release]`. + +## Examples + +### Building in Debug mode + +```sh +$ android build +``` + +### Building in Release mode + +```sh +$ android build --release +``` \ No newline at end of file diff --git a/docs/src/commands/devices.md b/docs/src/commands/devices.md new file mode 100644 index 0000000..698012e --- /dev/null +++ b/docs/src/commands/devices.md @@ -0,0 +1,19 @@ +# List Devices + +``` +USAGE: + android devices + +OPTIONS: + -h, --help Print help information +``` + +## What it does + +Executes `adb devices` and returns the output. + +## Example + +``` +$ android devices +``` \ No newline at end of file diff --git a/docs/src/commands/emulator.md b/docs/src/commands/emulator.md new file mode 100644 index 0000000..71c0d1e --- /dev/null +++ b/docs/src/commands/emulator.md @@ -0,0 +1,3 @@ +# android emulator + +TODO \ No newline at end of file diff --git a/docs/src/commands/install.md b/docs/src/commands/install.md new file mode 100644 index 0000000..d507e5b --- /dev/null +++ b/docs/src/commands/install.md @@ -0,0 +1,28 @@ +# Install App + +``` +USAGE: + android install [OPTIONS] + +OPTIONS: + -h, --help Print help information + -r, --release Should install release APK +``` + +## What it does + +Executes `adb install` under the hood and simply returns the output. + +## Examples + +### Install in Debug mode + +```sh +$ android install +``` + +### Install in Release mode + +```sh +$ android install --release +``` \ No newline at end of file diff --git a/docs/src/commands/launch.md b/docs/src/commands/launch.md new file mode 100644 index 0000000..15f46de --- /dev/null +++ b/docs/src/commands/launch.md @@ -0,0 +1,19 @@ +# Launch App + +``` +USAGE: + android launch + +OPTIONS: + -h, --help Print help information +``` + +## What it does + +It requests ADB to launch the configured main activity of the installed app onto the connected device or emulator, effectively running our app. + +## Example + +```sh +$ android launch +``` \ No newline at end of file diff --git a/docs/src/commands/run.md b/docs/src/commands/run.md new file mode 100644 index 0000000..289a210 --- /dev/null +++ b/docs/src/commands/run.md @@ -0,0 +1,28 @@ +# Run App + +``` +USAGE: + android run [OPTIONS] + +OPTIONS: + -h, --help Print help information + -r, --release Should build in release mode +``` + +## What it does + +It is a combination of three commands, [`android build`](./build.md), [`android install`](./install.md) and [`android launch`](./launch.md) giving you an illusion of a single operation being executed. + +## Examples + +### Running in Debug mode + +```sh +$ android run +``` + +### Running in Release mode + +```sh +$ android run --release +``` \ No newline at end of file diff --git a/docs/src/commands/shell.md b/docs/src/commands/shell.md new file mode 100644 index 0000000..ce0a83e --- /dev/null +++ b/docs/src/commands/shell.md @@ -0,0 +1,3 @@ +# android shell + +TODO \ No newline at end of file diff --git a/docs/src/faq.md b/docs/src/faq.md new file mode 100644 index 0000000..336d5c5 --- /dev/null +++ b/docs/src/faq.md @@ -0,0 +1,13 @@ +# Frequently Asked Questions + +## 1. Isn't there already an `android` tool that ships with the android SDK? + +Yes, there is an `android` bash script that comes with the Android SDK. However, it has been deprecated, and its functionalities have been absorbed into Android Studio, making it the only supported option for Android development. This decision has frustrated developers who prefer to use a CLI to manage their projects. + +## 2. But wait.. Don't I have to install Android Studio to get the SDK? + +Not necessarily. If you go to [Android Studio download page](https://developer.android.com/studio) and scroll down enough you'll see a section named 'Command line tools only'. Just grab that and there's no need for Android Studio. + +## 3. Is a simple wrapper even enough? + +Well yes and no, I eventually intend to build an interface on top of the existing commands in the near future to make actions more controllable and user-friendly as a whole. For example: imagine a prompt which lets you choose which device to run your project on, and even offer launching an emulator right there. there's so many possibilities. diff --git a/docs/src/get-started/create-or-link.md b/docs/src/get-started/create-or-link.md new file mode 100644 index 0000000..18d6863 --- /dev/null +++ b/docs/src/get-started/create-or-link.md @@ -0,0 +1,39 @@ +# Create or Link Project + +There are mainly two ways to get started -- either create a new project or link to an existing android project. + +## Create + +You may create or initialize a project using + +```sh +$ android create +``` + +And then answer a few prompts: + +- Destination path +- Project name +- Package identifier + +> The template project that this is based upon lives [here](https://github.com/SyedAhkam/android-cli-template). Open for contributions. + +After creating the project, you can start editing the source and run the project. + +```sh +$ cd +$ android run +``` + +## Link an existing project + +If you already have an android project bootstrapped, you will need to link it. + +```sh +$ android link +``` + +> You might need to dig into your own source code to figure out the appropriate prompt values. Especially the package identifier and main activity class name. + +All this essentially does is create a [.android](../reference/dot-android.md) file which is then relied upon by the CLI for future operations. + diff --git a/docs/src/get-started/installation.md b/docs/src/get-started/installation.md new file mode 100644 index 0000000..5530427 --- /dev/null +++ b/docs/src/get-started/installation.md @@ -0,0 +1,21 @@ +# Installation + +## Using cargo + +### From crates.io (no releases yet) + +```sh +$ cargo install android-cli +``` + +### From git directly + +```sh +$ cargo install --git https://github.com/SyedAhkam/android-cli.git +``` + +## Using github releases + +No releases yet + +> After installation, you should have access to the `android` binary from your choice of shell. \ No newline at end of file diff --git a/docs/src/introduction.md b/docs/src/introduction.md index 3d79791..2bbeb6b 100644 --- a/docs/src/introduction.md +++ b/docs/src/introduction.md @@ -1,5 +1,7 @@ # Introduction -Welcome to the documentation for Android CLI. +Android CLI is a powerful tool that simplifies and streamlines the Native Android development process. -Currently in development, stay tuned! \ No newline at end of file +It provides a single interface for developers to create, build, and release Android applications without the need for cumbersome IDEs like Android Studio. + +Github Project can be found [here](https://github.com/SyedAhkam/android-cli) \ No newline at end of file diff --git a/docs/src/legal.md b/docs/src/legal.md new file mode 100644 index 0000000..ff06ab7 --- /dev/null +++ b/docs/src/legal.md @@ -0,0 +1,7 @@ +# Legal + +The tool itself is forever free. Distributed under the MIT License. + +However, the Android SDK is not free. You must accept the Android SDK License Agreement before using the SDK. + +Additionally, the Android CLI is not affiliated with Google or the Android Open Source Project. Android is a trademark of Google Inc. \ No newline at end of file diff --git a/docs/src/reference/dot-android.md b/docs/src/reference/dot-android.md new file mode 100644 index 0000000..c04f4ea --- /dev/null +++ b/docs/src/reference/dot-android.md @@ -0,0 +1,3 @@ +# Dot Android + +TODO \ No newline at end of file