8

Android/Flutter 工程快速查找依赖和配置的脚本

 2 years ago
source link: https://droidyue.com/blog/2022/02/03/android-flutter-project-find-dep-and-config-in-a-very-fast-way/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Android/Flutter 工程快速查找依赖和配置的脚本

Feb 3rd, 2022

进行文件内容查找也是我们比较常做的事情,这里介绍两个比较常用的指定扩展名查找内容的脚本。

以上两个脚本均用于终端,非IDE,超级轻量快捷。

查找 gradle

对于 Gradle 文件中,我们可以用来过滤查询某个以来的内容,这可能最适合 Android 程序员了。

脚本内容(保存为gradleSearch.sh )

#!/bin/bash
find . -name "*.gradle" | xargs grep -E -n --color=always "$1"
 gradleSearch.sh kotlin
./android/app/build.gradle:25:apply plugin: 'kotlin-android'
./android/app/build.gradle:53:    kotlinOptions {
./android/app/build.gradle:216:    resolutionStrategy.force "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
./android/build.gradle:2:    ext.kotlin_version = '1.5.31'
./android/build.gradle:13:        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
grep: ./android/.gradle: Is a directory

查找yaml

对于 Flutter 工程来说,它使用了yaml 管理一些配置和依赖存放。我们使用下面的脚本可以精准地过滤我们想要的内容。

#!/bin/bash
find . -name "*.yaml" | xargs grep -E -n --color=always "$1"
yamlSearch.sh bloc
./pubspec.yaml:297:  bloc:
./pubspec.yaml:299:      name: bloc

droidyue_gzh_green_png.png

低价正版软件,限时优惠,Office 365,Typora等海量优惠

Posted by androidyue Feb 3rd, 2022

Android, Bash, Flutter, Gradle, IDE, Linux, Mac, Shell, YAML

« 一个检测 json 合法性的脚本

Android/iOS 终端快速截屏技巧 »


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK