see-seeker

1.3.0 • Public • Published

see-seeker

Quickly generate templates based on github repo or gitlab repo.

NPM version

This project was bootstrapped by create-neon.

Installing see-seeker

$ npm install see-seeker -g

Exploring see-seeker

After install see-seeker, you can explore it at the Node REPL:

$ npm install see-seeker -g
$ see https://github.com/Dlouxgit/see ./see

Available Scripts

In the project directory, you can run:

see [select [dest]]

Pull items from the local list to the dest directory, dest defaults to the current directory.

see set-token <access_token>

Set gitlab's private token for internal projects.

see <repo-url> [dest]

Pull the project of repo-url to the directory corresponding to dest, dest is the current directory by default.

Project Layout

The directory structure of this project is:

see/
├── Cargo.toml
├── README.md
├── index.node
├── package.json
├── src/
|   └── lib.rs
├── bin/
|   └── main.js
└── target/

Cargo.toml

The Cargo manifest file, which informs the cargo command.

README.md

This file.

index.node

The Node addon—i.e., a binary Node module—generated by building the project. This is the main module for this package, as dictated by the "main" key in package.json.

Under the hood, a Node addon is a dynamically-linked shared object. The "build" script produces this file by copying it from within the target/ directory, which is where the Rust build produces the shared object.

package.json

The npm manifest file, which informs the npm command.

src/

The directory tree containing the Rust source code for the project.

src/lib.rs

The Rust library's main module.

bin/main.js

The cli main file.

target/

Binary artifacts generated by the Rust build.

Learn More

To learn more about Neon, see the Neon documentation.

To learn more about Rust, see the Rust documentation.

To learn more about Node, see the Node documentation.

LICENSE

ISC

    let re = Regex::new("^(?:(?:https://)?([^:/]+.[^:/]+)/|git@([^:/]+)[:/]|([^/]+):)?(?P<user>[^/s]+)/(?P<name>.+)(?P<subdir>:(?P<refer>(?:/[^/s#]+)+))?(?:/)?(?:#(.+))?")
    .unwrap();
    if re.is_match(src) {

        let caps: regex::Captures<'_> = re.captures(src).unwrap();
        let matched_site = caps.get(1).or(caps.get(2)).or(caps.get(3));
        let site: String;
        if let true = matched_site.is_some() {
            let reg = Regex::new(".(com|org)$").unwrap();
            site = reg.replace_all(matched_site.unwrap().as_str(), "").to_string();
        } else {
            site = String::from("github");
        }

        let mut res = false;
        let mut mode = String::from("git");
        for (_, v) in VALID_SITES.iter().enumerate() {
            if site.contains(v) {
                res = true;
                mode = String::from("tar");
            }
        }
        if !res && !site.starts_with("gitlab") {
            return Err("cli supports GitHub, GitLab");
        }

        let domain = site.clone() + ".com";
        
        let user = caps.name("user").unwrap().as_str().to_string();
        let name = caps.name("name").unwrap().as_str().replace(".git", "").to_string();
        let subdir;
        subdir = match caps.name("subdir") {
            None => "xxx",
            Some(i) => i.as_str(),
        }.to_string();
        let refer;
        refer = match caps.name("refer") {
            None => "HEAD",
            Some(i) => i.as_str(),
        }.to_string();
        let url = format!("https://{domain}/{user}/{name}");
        println!("urlrs{:?}", url);
        let ssh = format!("git@{domain}:{user}/{name}");
        println!("ssh{:?}", ssh);

        Ok(UrlInfo {site, _user: user, name, _refer: refer, url, _ssh: ssh, _subdir: subdir, _mode: mode})
    } else {
        return Err("Not enough arguments.");
    }

Package Sidebar

Install

npm i see-seeker

Weekly Downloads

0

Version

1.3.0

License

ISC

Unpacked Size

20.1 MB

Total Files

4

Last publish

Collaborators

  • dloux