Skip to content

Commit

Permalink
callback test
Browse files Browse the repository at this point in the history
  • Loading branch information
arka-pramanik-hpe committed Feb 4, 2025
1 parent 8dcc1d9 commit 0129d3d
Showing 1 changed file with 28 additions and 2 deletions.
30 changes: 28 additions & 2 deletions cray/modules/rrs/cli.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# MIT License
#
# (C) Copyright 2020-2023 Hewlett Packard Enterprise Development LP
# (C) Copyright 2020-2024 Hewlett Packard Enterprise Development LP
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
Expand All @@ -24,5 +24,31 @@
""" rrs """
# pylint: disable=invalid-name
from cray.generator import generate
import click

cli = generate(__file__)
# def print_response(resp):
# # Intercept the response by printing it.
# print(resp)
# print("I am printing")
# click.echo(resp)
# click.echo("I am using click to echo")
# # Return the response unchanged (or modify if needed).
# return resp

def _rrs_format_response(cb):

def _cb(ctx, param, value):
data = value.read()
print(data)
print("I am printing")
click.echo(data)
click.echo("I am using click to echo")
if cb:
return cb(ctx, param, data)
return data

return _cb


# Pass the callback to generate
cli = generate(__file__, callback=_rrs_format_response)

0 comments on commit 0129d3d

Please sign in to comment.