BashSpark
Loading...
Searching...
No Matches
command_seq.h
Go to the documentation of this file.
1
27#pragma once
28
29#include "BashSpark/command.h"
30
31namespace bs {
41 class command_seq : public command {
42 public:
47 : command("seq") {
48 }
49
64 shell_status run(const std::span<const std::string> &vArgs, shell_session &oSession) const override;
65
66 public:
72 virtual void msg_error_param_number(std::ostream &oStdErr, std::size_t nArgs) const;
73
79 virtual void msg_error_int_format(std::ostream &oStdErr, const std::string &sInt) const;
80
86 virtual void msg_error_int_bounds(std::ostream &oStdErr, const std::string &sInt) const;
87
95 virtual void msg_error_logics(std::ostream &oStdErr, std::int64_t nMin, std::int64_t nStep,
96 std::int64_t nMax) const;
97 };
98}
Prints a sequence on stdout. Supports negative numbers and decreasing sequences.
Definition command_seq.h:41
virtual void msg_error_int_bounds(std::ostream &oStdErr, const std::string &sInt) const
Print an error if an integer values is outside the bounds of c2 64 bit binary.
Definition command_seq.cpp:89
virtual void msg_error_param_number(std::ostream &oStdErr, std::size_t nArgs) const
Print an error if the wrong number of arguments is provided.
Definition command_seq.cpp:81
shell_status run(const std::span< const std::string > &vArgs, shell_session &oSession) const override
Prints a sequence on stdout.
Definition command_seq.cpp:36
command_seq()
Constructs command.
Definition command_seq.h:46
virtual void msg_error_logics(std::ostream &oStdErr, std::int64_t nMin, std::int64_t nStep, std::int64_t nMax) const
Print an error if the parameters are incoherent, meaning the sequence can not be completed.
Definition command_seq.cpp:96
virtual void msg_error_int_format(std::ostream &oStdErr, const std::string &sInt) const
Print an error if a parameter is non integer.
Definition command_seq.cpp:85
Abstract base class for all shell commands.
Definition command.h:50
Represents an execution environment for a shell instance.
Definition shell_session.h:57
Defines the bs::command interface and built-in shell commands.
BashSpark main namespace.
Definition command.h:39
shell_status
Shell status codes.
Definition shell_status.h:47