当前位置 博文首页 > 源代码快速定位工具-qwandry使用指南

    源代码快速定位工具-qwandry使用指南

    作者:admin 时间:2021-02-11 15:02

    GitHub地址:https://github.com/adamsanderson/qwandry

    qwandry 能快速定位到我们需要找到 库文件, 项目 的工具。

    Ruby中实现快速定位的方法有好多种,我知道的有三个:

    cd `bundle show active_record`
    

    通过tag方法(tag 定位更精确,可以定位到方法级别)
    或者通过 qwandry
    安装


    gem install qwandry
    

    使用

    qw matrix # opens ruby's matrix class in your editor
    qw rails  # will ask you which version of rails you want to open
    qw activerec 3.1 # will find the gem activerecord 3.1 and open it
    You can also use Qwandry with other common languages:
    qw -r python numpy # opens python's numpy library
    qw -r perl URI # open perl's URI library
    qw -r node express # open express if it is installed for node
    

    指定编辑器打开

    EDITOR=subl qw activerecord 3.2.14
    

    如何自定义?


    touch ~/.qwandry/init.rb
    

    然后copy如下内容到文件中

    register 'projects' do
     add 'your project path'
    end
    
    default :ruby, :gem, :projects
    
    

    解释

    register 方法是 将指定的目录打包

    add 将目录加入到搜索中

    default 是设置默认的搜索范围

    实现的基本原理

    通过配置 config 将很多目录打包成 Package, 然后将 Package 打包成 Repository(仓库)
    初始化一个Launcher(有Editor等)

    根据输入的名称找到对应的Repository中的package(实际上是一个目录地址)

    执行系统命令: editor(vim) path

    js
下一篇:没有了