Skip to main content

Cli

Struct Cli 

Source
pub struct Cli {
Show 26 fields pub method: Option<String>, pub headers: Vec<String>, pub data: Option<String>, pub auth_type: Option<String>, pub username: Option<String>, pub verbose: bool, pub trace: bool, pub stream: bool, pub file: Option<String>, pub app: Option<String>, pub output: OutputFormat, pub json: bool, pub jsonl: bool, pub raw: bool, pub no_pager: bool, pub quiet: bool, pub no_interactive: bool, pub timeout: u64, pub color: ColorChoice, pub dry_run: bool, pub limit: Option<i32>, pub cursor: Option<String>, pub page: Option<String>, pub after: Option<String>, pub command: Option<Commands>, pub url: Option<String>,
}
Expand description

Auth-enabled curl-like interface for the X API.

Fields§

§method: Option<String>

HTTP method (GET by default)

§headers: Vec<String>

Request headers

§data: Option<String>

Request body data

§auth_type: Option<String>

Authentication type (oauth1, oauth2, app)

§username: Option<String>

Username for OAuth2 authentication

§verbose: bool

Print verbose information

§trace: bool

Add trace header to request

§stream: bool

Force streaming mode

§file: Option<String>

File to upload (for multipart requests)

§app: Option<String>

Use a specific registered app (overrides default)

§output: OutputFormat

Output format. text (default), json, jsonl, ndjson (alias of jsonl), yaml (.yml), csv, tsv. Formats not in the value enum (e.g. toml, xml) are not supported — xurl emits a JSON envelope with reason invalid-args if requested.

§json: bool

Shorthand for --output json (P2 alias).

§jsonl: bool

Shorthand for --output jsonl (P2 alias).

§raw: bool

Emit unstyled, compact output. Strips ANSI in text mode; compact (no pretty-printing) JSON in json/jsonl modes.

§no_pager: bool

Documented no-op. xr writes directly to stdout and never invokes $PAGER; this flag is advertised so agents can pass --no-pager unconditionally without xr rejecting it.

§quiet: bool

Suppress all non-essential output (errors still go to stderr)

§no_interactive: bool

Disable interactive prompts; fail with error instead

§timeout: u64

Request timeout in seconds

§color: ColorChoice

Colorize output: auto (TTY-aware), always, or never

§dry_run: bool

Validate inputs and skip the API call (U7).

Honored by every write op; emits a canonical dry-run envelope on stdout under --output json / --output jsonl, or a “Would …” line under --output text. Read ops ignore it.

§limit: Option<i32>

Global result-set limit, clamped to 1..=100 (U7).

Applies to every list-style command. The per-command -n/--max-results flag takes precedence when both are set.

§cursor: Option<String>

Pagination cursor / pagination_token for list endpoints.

The X API uses cursor-based pagination: each list response carries a meta.next_token field, and the next page is fetched by re-running the same command with --cursor <token> (or XURL_CURSOR=<token>). Threads through to the pagination_token query parameter on every search, timeline, mentions, bookmarks, likes, following, followers, and dms invocation.

§page: Option<String>

Documented alias for --cursor.

X’s API does not offer offset-style pagination (--page 2 is not addressable). Passing --page returns a canonical unsupported-pagination envelope on stderr suggesting --cursor instead. Exposed so agents trained on offset-pagination conventions get a structured error rather than a silent no-op.

§after: Option<String>

Documented alias for --cursor (--after <token>).

Threads through to the same pagination_token query parameter as --cursor. Exposed so agents that picked up “after-style” pagination from other CLIs (gh, kubectl) get a working flag.

§command: Option<Commands>

Subcommand to run

§url: Option<String>

URL for raw mode (positional, only when no subcommand)

Implementations§

Source§

impl Cli

Source

pub fn effective_output(&self) -> OutputFormat

Resolves the effective output format after applying --json / --jsonl aliases.

--jsonl wins over --json if both were set (they conflict via clap, so at most one survives parsing); either alias overrides --output.

Trait Implementations§

Source§

impl Args for Cli

Source§

fn group_id() -> Option<Id>

Report the ArgGroup::id for this set of arguments
Source§

fn augment_args<'b>(__clap_app: Command) -> Command

Append to Command so it can instantiate Self via FromArgMatches::from_arg_matches_mut Read more
Source§

fn augment_args_for_update<'b>(__clap_app: Command) -> Command

Append to Command so it can instantiate self via FromArgMatches::update_from_arg_matches_mut Read more
Source§

impl CommandFactory for Cli

Source§

fn command<'b>() -> Command

Build a Command that can instantiate Self. Read more
Source§

fn command_for_update<'b>() -> Command

Build a Command that can update self. Read more
Source§

impl Debug for Cli

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl FromArgMatches for Cli

Source§

fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>

Instantiate Self from ArgMatches, parsing the arguments as needed. Read more
Source§

fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>

Instantiate Self from ArgMatches, parsing the arguments as needed. Read more
Source§

fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.
Source§

fn update_from_arg_matches_mut( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.
Source§

impl Parser for Cli

Source§

fn parse() -> Self

Parse from std::env::args_os(), exit on error.
Source§

fn try_parse() -> Result<Self, Error>

Parse from std::env::args_os(), return Err on error.
Source§

fn parse_from<I, T>(itr: I) -> Self
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Parse from iterator, exit on error.
Source§

fn try_parse_from<I, T>(itr: I) -> Result<Self, Error>
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Parse from iterator, return Err on error.
Source§

fn update_from<I, T>(&mut self, itr: I)
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Update from iterator, exit on error. Read more
Source§

fn try_update_from<I, T>(&mut self, itr: I) -> Result<(), Error>
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Update from iterator, return Err on error.

Auto Trait Implementations§

§

impl Freeze for Cli

§

impl RefUnwindSafe for Cli

§

impl Send for Cli

§

impl Sync for Cli

§

impl Unpin for Cli

§

impl UnsafeUnpin for Cli

§

impl UnwindSafe for Cli

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more