Skip to content

Expose a library crate (lib.rs) for programmatic Rust usage #211

@geofflittle

Description

@geofflittle

Request

Would it be possible to split the crate into a lib.rs + bin.rs so that other Rust projects can depend on gws as a library?

Use case

I'm building a Rust application that interacts with Google Drive (and potentially other Workspace APIs). Currently the only integration path is shelling out to gws as a subprocess, which adds overhead and loses type safety.

If gws exposed its core functionality — authentication, Discovery Service client, request execution — as a library crate, Rust projects could depend on it directly:

[dependencies]
gws = { git = "https://github.com/googleworkspace/cli" }

The dynamic Discovery-based approach is exactly what makes this project compelling as a library — rather than hand-rolling clients for each Google API, downstream crates could reuse the same infrastructure.

Suggested structure

A minimal split might look like:

  • src/lib.rs — auth, discovery client, request execution, response types
  • src/main.rs — CLI parsing, output formatting (uses lib.rs)

No API changes needed to the CLI itself.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions